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

[REBOL] Re: Problems with parsing

From: brett:codeconscious at: 30-Nov-2001 13:52

Hi Romano, Thanks for your post. It is a good demonstration of how a problem can often be thought about differently and therefore solved. Something important to keep in mind with creating parse rules. Something to think about regarding your solution is the ways that it is not equivalent to mine. You already pointed out that yours returns true for a void block by design. But yours also returns true when '| is the first word in the block. Also by design? :) It doesn't really matter if was or wasn't by design, but it might be interesting to work out how you would change your rule to ensure that '| is not the first word in the block. However, my purpose wasn't to show how my example block could be parsed. Peter asked for a rule that matched text NOT including a special pattern. NOT is a useful operator in logic, I wonder why it is not in Parse as a dialect keyword. That is, would it not be nice to have the following statement return true? parse [b] [not 'a] Ladislav orginally solved this problem when I asked about it before. He has some parse enhancements on his rebsite in the script called parseen.r. Worth a look. I could have saved some typing by responding to Peter that his question is answered in parseen.r by Ladislav - though you may need to look twice or thrice and learn something new to follow it - as is typical of Ladislav's work ;-) Regards, Brett.