Hi Andy,
Unless I'm missing something, this really isn't an IMP issue - LPG is responsible for tokenizing the character stream.
Have you tried raising your problem on the LPG forums on sourceforge?
Or, failing that, you could try contacting the main LPG developer (Philippe Charles) directly at pgcharles@xxxxxxxxxxx. On Sep 30, 2009, at 4:54 PM, Crapo, Andrew (GE, Research) wrote: This really is a show-stopper for me. Using older versions of IMP, I had both a Minus '-' as a terminal in the grammar and a hyphenated keyword ("top-level") in the lexicon. I cannot get this to work with the latest version of IMP. No matter what I have tried, the '-' splits the character stream into separate tokens. For exaple, if I create a new project with the leg grammar and then add a new type keyword, "aa-bb", dumpTokens shows that "aa" is identified as an identifier, '-' as a Minus, and "bb" as an identifier. Is there some way to have "-" as an terminal of the grammar and still use it as a character in a keyword? If so, how? Andy Crapo GE Research
The image just showed a sentence in the language: Rock is a top-level class. with a red underline starting with the hyphen and going to the end of the line. The popup error says "{0} unexpected token(s) ignored: "ERROR_TOKEN"". Looking at what happens, it checks "top" to see if it is a keyword, then encounters the hyphen which is unexpected, then checks "level" to see if it is a keyword. Thanks, Andy Hi Andy,
For some reason I can't access the image of the error in your message. [I think your attempt to attach it failed - the picture has the name "No AttachName".) Can you try again? On Sep 8, 2009, at 1:44 PM, Crapo, Andrew (GE, Research) wrote: I'm upgrading from a very old version of IMP (about the time you became an Eclipse incubator project) to the latest version. I can't seem to get a keyword with a hyphen to work--worked in old version. In KWLexer.gi: %Export … toplevel … %End %Terminals a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Hyphen ::= '-' %End %Rules Keyword ::= ….. | t o p Hyphen l e v e l /.$setResult($_toplevel);./ …. %End %Headers /. static { tokenKind['-'] = SADLKWLexersym.Char_Hyphen; // Map the hyphen character } ./ %End Result is a error at the hyphen: I've also tried it with tokenKind['-'] = SADLKWLexersym.Char_Hyphen; Which is what worked in the old version. -- Cheers, - Bob ------------------------------------------------- Robert M. Fuhrer Research Staff Member Programming Technologies Dept. IBM T.J. Watson Research Center
|