AltME: Parse

Messages

Pekr
Is 'not availabe in terms of R2 parse at all?
Endo
Better asking; how do I do on R2 something like:
PARSE/all "abc" ["a" not "x" "c"]  ;==true
@Perk: No, unfortunately not.
>> parse "x" [not "a"]
** Script Error: Invalid argument: ?native?
Endo
Normally I won't compare with one char, so using a complemented charset is not useful for me.
not-a: complement charset "a"
parse/all "x" [not-a] ; == true
Geomol
Won't this work?
>> not-x: complement charset "x"
>> parse "abc" ["a" not-x "c"]
== true
>> parse "axc" ["a" not-x "c"]
== false
Pekr
Geomol just beat me to that :-)
Endo
:-) I beat you both :P
Geomol
Why is complemented charset not useful?
Endo
Because I need to NOT a word.
Something like:
>> parse/all "this" [some ["this" (print "ok" halt) | skip] ]
ok
>> parse/all "this" [some ["that" (print "ok" halt) | skip] ]
== true
But I don't know how to stop PARSE in the first example.
Instead of HALTing.
Geomol
to end 1 skip
Which will always return false, I think.
or just: to end skip
Endo
Sorryi I confused I think, how do I write "except this one" like rule.
>> not-four: ["four" to end skip]
== ["four" to end skip]
>> parse/all "one two three" ["one " not-four " three"]
== false
Geomol
>> parse/all "one two three" ["one " [not-four | to " "] " three"]
== true
Or use block parsing, if that's an option.
argh :)
Doesn't work.
I guess, you need to include all the ok possibilities?
Endo
Block parsing could be useful but I'm parsing huge SQL files which are not LOADable (and different formats from each other).
Switching to R3 is easier.
I think I need to play with index positions during the parse.

Last message posted 45 weeks ago.