|
******************* REPOSTING
***********
Hello,
I'm having a problem with understanding Parsing using recursion. The code below consists of 4 tests. Tests 1 and 4 produce the correct results, both in terms of the values in the block and that they returns TRUE. The [none] in the rule makes this happen. Test 2 produces the correct values in the block but returns FALSE, presumably because [none] is missing from the rule. However why does Test 3 return TRUE but process the last input value twice?? Mike. REBOL [] check: func [ ] [clear inps probe parse "123+" col print inps clear inps probe parse "123+456-" col print inps ] inps: [] digits: charset "0123456789" num: [copy value [some digits] (value: to-decimal value)] term: [num ["+" (insert tail inps value)|"-" (insert tail inps negate value)]] ;Test 1 print "Test 1" col: [term col | [none]] check ;Test 2 print "Test 2" col: [term col] check ;Test 3 print "Test 3" col: [term col | term] check ;Test 4 print "Test 4" col: [term col | term | [none]] check |
