Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search


 [1/3] from: arnaud:dutartre:europe:tgs at: 31-Oct-2002 14:22

Hello, I have a simple question : I try to parse a string text: " -a bb" note-rules: [ some ["-a" (print "a") |"b" (print"b")]] It works like that but if I change the rule by adding a space before -a it does not work : note-rules: [ some [" -a" (print "a") |"b" (print"b")]] Could you tell me why ? Thx Arno:)

 [2/3] from: anton:lexicon at: 1-Nov-2002 1:27

parse by default ignores the whitespace. Use parse/all if you need to consider whitespace. You can just do this: parse/all text note-rules But it won't succeed all the way because your rule does not handle the second space. You can try this parse rule construction: some [a-rule | b-rule | " "] to handle spaces that are not already handled by a-rule or b-rule. Anton.

 [3/3] from: lmecir::mbox::vol::cz at: 31-Oct-2002 15:18

Hi Arnaud,
> I try to parse a string > text: " -a bb"
<<quoted lines omitted: 5>>
> Thx > Arno:)
You have got two choices: 1) let PARSE handle whitespace automatically. Then you cannot use whitespace in your rule, because PARSE filters whitespace out. 2) don't let PARSE to handle whitespace automatically. You have to call PARSE as follows: parse/all text note-rules In this case your rule doesn't look correct, because it cannot handle the whitespace before "bb".

  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted