On 09/14/2012 05:59 AM, kototama kototama wrote:
> I'm having problem parsing ratio numbers (ex. 1/4, -1/5, +1/3) with
> Wisent. When using re-builder the "[-+]?[0-9]+/[0-9]+" regex
> works well but when defining a simple regex analyzer like this:
> (define-lex-simple-regex-analyzer wisent-test-lex-ratio
> "Detect ratio numbers."
> it does work and I get the "unmatched text during analysis error".
> Strangely, if I replace / by ! in the regex and try parsing numbers
> 1!3 +1!4 etc. It works.
> Also if I try this regex "[-+]?[0-9]+/[a-z]+" and parses 1/a -1/b it also works.
> What's the problem with the definition of the lex regex?
Sometimes different lexers can interact with each other. Your best bet
is to put the cursor near the beginning of your buffer with your example
text, and use:
M-x semantic-lex-debug RET
and see what gets matched and highlighted as you go. If your previous
expression finds a chunk of your next expression, then it won't match
You could also put the cursor on the first char of a ratio, and run the
debugger, and see if it catches it that time.
I didn't find any special treatment of / in the lexer, but / is
sometimes part of comment syntax, so might be picked up that way by a