Yes, parenthesized expressins in syntax patterns cannot be recognized correctly. If you have a patch for this I can incorporate it.
While we are at regular expressions. You asked in another thread how to maintain token-seperator and other information when using 'parse'.
Here is a solution with 'replace' using the replacement function to do the work and report the token seperators:
With 'parse' when can do somthing too, but I have to think about it. Meanwhile you could use 'replace' with a parse grammatik in the search pattern and use a userdefined function in the replacement expression to supply information. Here is a simple example:
Code: Select all
> (set 'prog "x=y+z")
(define (foo) (println "token:" $1) (println "separator:" $2) $0)
(replace "([a-z]+)([=+])" prog (foo) 0)
token:x
separator:=
token:y
separator:+
"x=y+z"
Lutz
ps: this does not report handling the character position though. You would have to build a solution with 'regex' which also reports the position.