World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
Steeve 27-Jun-2007 [1962] | not true |
Brock 27-Jun-2007 [1963x2] | why would AB return false? |
so it must be three characters? | |
Steeve 27-Jun-2007 [1965x2] | because i want parse the complete serie "ABC" in any combination |
yes 3 characters | |
btiffin 27-Jun-2007 [1967] | What it you put 1 repeats inside the some? |
Steeve 27-Jun-2007 [1968] | write it plz |
btiffin 27-Jun-2007 [1969] | nevermind... just tried it. piping up out of turn again :) |
Steeve 27-Jun-2007 [1970x2] | i just don't understand what you mean |
ah ok, it doesn't work :-) | |
Brock 27-Jun-2007 [1972] | do all three characters need to be present? |
btiffin 27-Jun-2007 [1973] | I tried parse "AB" [some [1 "A" | 1 "B" | 1 "C"] | none] ...returns true |
Brock 27-Jun-2007 [1974] | or can characters be duplicated? |
Steeve 27-Jun-2007 [1975] | no Brock |
Brock 27-Jun-2007 [1976] | the | none handles situations where the rule doesn't apply, so almost everything will return true |
btiffin 27-Jun-2007 [1977] | Brock; Without it it'll endless loop no? |
Steeve 27-Jun-2007 [1978x2] | no |
just never use an ''opt" rule in a some or any block | |
Brock 27-Jun-2007 [1980] | will it just be instances of A B & C? |
Steeve 27-Jun-2007 [1981x6] | one instance of each in any order (but just one instance) |
the awaiting result is a: b: c: false parse "CAB" [some ["A" (a: true) | "B" (b: true) | "C" (c: true)]] if all [a b c ] [print "ok"] | |
*expecting result | |
except that this code is wrong for series with repeting characters like "AABCC" | |
(should increment a b and c instead using boolean) | |
anyway , that's not the point , i know how to do that, but i just think it's ugly | |
btiffin 27-Jun-2007 [1987x2] | parse "ABC" [3 [1 "A" | 1 "B" | 1 "C"]] ? |
nevermind... :) AAA returns true | |
Steeve 27-Jun-2007 [1989x2] | yep |
i really think it's not feasible without using counters | |
Brock 27-Jun-2007 [1991x3] | I think I have it define a rule; rule: [1 ["A" | "B" | "C"]] then parse parse "cAB" [[rule] [rule] [rule]] |
the one indicates that there must be an occurence of one of the three characters... supplying the rule then requires three characters to be entered. | |
... but it allows multiple characters... damn | |
Steeve 27-Jun-2007 [1994] | and it works too with the serie "AAA" |
Brock 27-Jun-2007 [1995] | which is bad |
Steeve 27-Jun-2007 [1996] | yrp |
btiffin 27-Jun-2007 [1997] | parse can change the string as it goes right? What if you tried marking them off with X's as you found them? |
Brock 27-Jun-2007 [1998] | I was thinking the same thing, removing each character from a block as each rule is processed. |
Steeve 27-Jun-2007 [1999] | yeah it's possible but it's like hanging counters, you need to have some code to check the result and allowing the parser to continue further |
Brock 27-Jun-2007 [2000] | so your ideal solution would not use anyting other than parse? |
Steeve 27-Jun-2007 [2001x2] | yeah i would use a clean dialect , cause i have many many rules of this type |
moreover , i just don't want parse simple series like "ABC" | |
Brock 27-Jun-2007 [2003x2] | what about a 'unique function or something that tests the string for unique characters? |
... then parse | |
Steeve 27-Jun-2007 [2005] | as i said , it was just an example , in fact in my case: "A" "B" and "C" are complex subrules, so unique don't apply |
Brock 27-Jun-2007 [2006] | I think you've lost me. So when you say sub-rules, you are really saying sub 'parse' rules for your dialect? |
Steeve 27-Jun-2007 [2007] | yep |
Brock 27-Jun-2007 [2008x2] | Will there be more than three rules possible? You indicate "A" "B" and "C", but could another instance of this also have a fourth character? |
each being unique sub-rules | |
Steeve 27-Jun-2007 [2010x2] | yep, it's not limited |
but when i say complex sub-rules , i mean that i have not to check single character only, but complex sentences | |
older newer | first last |