| Imadatobanisa (647) | |||||
|
Hello everybody... I'm now making a group of code which can allow the parser to read the value inside the bracket [...] I have no idea, but to make it properly, I thought up several important steps :
For example : number[50]; //number[50] = 50; And, here is my solution :
And my output (It did successfully) :
Then next step I tried parsing the expression : number[10 + number[10] + 10]Certainly the result is 30, but unfortunately, my solution doesn't work :( I have no idea why and how it skips "number[10] + 10" then generates the final value 10. Thanks for any help. :) | |||||
|
Last edited on
|
|||||
| Imadatobanisa (647) | ||
|
OMG...I detected that the algorithm stops immediately for no reason when it meets any end bracket sign symbol. Thus, I'm pretty sure "number[10] + 10" especially after the first bracket "]" the string "+ 10]" is never reached then parsed. :( Then actually the expression I've just caught is :
The element "number[10" is missing one bracket so the parser cannot accept this number. So the result is 10 not 30 :( Therefore, I have to make a loader which can handle multiple "bracket symbols-expressions"... Any idea? How to fix this problem guys? (Any help would be greatly appreciated) | ||
|
Last edited on
|
||
| modoran (1245) | |
| I'd use regular expressions for this kind of tasks. | |
|
|
|
| Imadatobanisa (647) | |
| But, how? Anybody? | |
|
|
|
| Imadatobanisa (647) | ||||
|
Wow my idea... Here is my solution : The find function now is modified. (string, chr, length, startpos) (ERROR : -1)
Now if we have a small-length string e.g "[[[[[]]]]]" - 10 characters which first five characters are "[" and five last characters are "]". And here is my result :
Is this a good idea? And any better solution guys? | ||||
|
Last edited on
|
||||