|
Pages: [1]
|
 |
|
Author
|
Topic: parse problem (Read 263 times)
|
parser
Guest
|
I don't understand why it does parse only partially by extracting only y and not z :
input: {x op1 y op2 z}
rules-partial: [ thru " op1 " copy text1 to " op2 " (ask text1) thru " op2 " copy text2 to newline (ask text2) (probe text1 probe text2 ask "") ]
parse input rules-partial
----------- Pasting above in the console it only gives me y and not z:
>> input: {x op1 y op2 z} == "x op1 y op2 z" >> >> rules-partial: [ [ thru " op1 " copy text1 to " op2 " (ask text1) thru " op2 " copy text2 to newline (ask text2) [ (probe text1 probe text2 ask "") [ ] == [ thru " op1 " copy text1 to " op2 " (ask text1) thru " op2 " copy text2 to newline (ask text2) (probe text1 probe text... >> >> parse input rules-partial y== false >>
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
I don't see a newline in input's string, so I assume that's your problem. Either add one. ie... input: {x op1 y op2 z^/} or instead of using to newline, use to end. Hope that helps.
|
|
|
|
|
Logged
|
- Carl Read
|
|
|
parser
Guest
|
Hi, thanks but I tried with end and it does give the same result
>> input: {x op1 y op2 z} == "x op1 y op2 z" >> >> rules-partial: [ [ thru " op1 " copy text1 to " op2 " (ask text1) thru " op2 " copy text2 to end (as k text2) [ (probe text1 probe text2 ask "") [ ] == [ thru " op1 " copy text1 to " op2 " (ask text1) thru " op2 " copy text2 to end (ask text2) (probe text1 probe text2 as... >> parse input rules-partial y== false >>
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
Please note that you are redefining INPUT, and using ASK. See the source of ASK: ask: func [ "Ask the user for input." question [series!] "Prompt to user" /hide "mask input with *" ][ prin question trim either hide [input/hide] [input] ] Anyway: >> parse/all "x op1 y op2 z" [thru "op1" copy text1 to "op2" "op2" copy text2 to end] == true >> text1 == " y " >> text2 == " z"
|
|
|
|
|
Logged
|
|
|
|
parser
Guest
|
Thanks a lot both, it has solved my problem
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |