Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327051 - Wrong backtracking in case of keywords with common prefix
Summary: Wrong backtracking in case of keywords with common prefix
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-05 19:47 EDT by Dénes Harmath CLA
Modified: 2012-11-16 05:25 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dénes Harmath CLA 2010-10-05 19:47:50 EDT
Build Identifier: M20100909-0800

The lexer & parser even when backtracking can't handle the following case (keywords which share the same prefix):

Reproducible: Always

Steps to Reproduce:
Grammar:

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Model: expressions+=Expression+;

Expression: Bar | Baz | Other;

Bar: {Bar} "\\bar";

Baz: {Baz} "\\baz";

Other hidden(): "\\" id=ID;

Generator options:

fragment = parser.antlr.ex.rt.AntlrGeneratorFragment {
options = {
backtrackLexer = true
backtrack = true
}
}

Input:

\b

Error:

no viable alternative at character '\'

Xtext version: 1.0.1.v201008251220
Comment 1 Henrik Lindberg CLA 2010-11-29 09:45:06 EST
I am having problems with this as well - backtracking lexer and keywords "else" and "elsif" will report problems for the combination of "el" as in "hello" when used elsewhere. Removing the "elsif" from my grammar makes it work.
Comment 2 Sven Efftinge CLA 2012-11-16 05:25:16 EST
I fear that we can't do much about it as it appears to be an Antlr problem.