Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [xtext] Error in the generated PartitionScanner
[xtext] Error in the generated PartitionScanner [message #618879] Wed, 06 August 2008 15:24
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
by taking a look at the generated antlr grammar, the STRING token takes
care of escaping character \ (which is a really good thing :-)

RULE_STRING :

'"' ( '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | ~('\\'|'"') )* '"' |
'\'' ( '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | ~('\\'|'\'') )* '\''

;

However, the generated GeneratedPartitionScanner.java in the .editor
plugin, does not consider the escape character:

public class GeneratedPartitionScanner extends AbstractPartitionScanner {

@Override
public List<IPredicateRule> getRules() {
List<IPredicateRule> rules = new ArrayList<IPredicateRule>();

...
rules.add(new MultiLineRule("\"","\"", string));
rules.add(new MultiLineRule("'","'", string));
return rules;
}

in fact, in the generated editor the highlighting of a string of the shape

"this is \"a test\""

does not generate an error (right!) but it is not highlighted correctly.

The generated partition scanner should consider the escape character:

public class GeneratedPartitionScanner extends AbstractPartitionScanner {

@Override
public List<IPredicateRule> getRules() {
List<IPredicateRule> rules = new ArrayList<IPredicateRule>();

...
rules.add(new MultiLineRule("\"","\"", string, '\\'));
rules.add(new MultiLineRule("'","'", string, '\\'));
return rules;
}

where should I fix this?
if I modify the generated partition scanner directly I assume it will be
overwritten...

thanks
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Wizard inheritance and call
Next Topic:[Epsilon] Configuring HUTN file
Goto Forum:
  


Current Time: Fri Apr 19 10:25:15 GMT 2024

Powered by FUDForum. Page generated in 0.02173 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top