
Some parts of this message have been removed.
Learn more about Nabble's
security policy.
If multi-character tokens are only valid within []'s then you need to switch to a new lexical state when encountering a [ and define the longer tokens only for that state, then return to the default state when you see the ]. That way there won't be any clashes due to longest-match-wins which you are getting currently.
How to do that is covered in the docs.
On 5/6/09, Rajarshi Guha <rguha@...> wrote:
Hi, I'm trying to fix a JJTree parser but am I little confused as to the source of the problem.
First: the parser tries to parse SMARTS, which are query patterns for molecular substructure matching.
Given a string: Sc1ccccc1
the parser should recognize S and c as two separate atom (tokens). The problem is that Sc is also a valid token - but the specification says that it must be enclosed in [ and ] - which is not the case here.
As a result, the parser only sees the S and c as Sc and then reports the pattern as invalid.
So I'm trying to work out how to make the parser recognize the Sc as two separate tokens - S & c.
(I have probably not given enough information but I've tried to keep the description simple and generic. The entire parser code is available at http://cdk.git.sourceforge.net/git/gitweb.cgi?p=cdk;a=blob_plain;f=src/main/org/openscience/cdk/smiles/smarts/parser/SMARTSParser.jjt;hb=master)
Any pointers would be approciated
-------------------------------------------------------------------
Rajarshi Guha <rguha@...>
GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84
-------------------------------------------------------------------
Q: What's polite and works for the phone company?
A: A deferential operator.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...
--
- J.Chris Findlay
(c: