use of org.eclipse.xtext.parser.antlr.XtextTokenStream in project xtext-core by eclipse.
the class InternalExBeeLangTestLanguageParser method entryRulePath.
// $ANTLR end "ruleRequiredCapability"
// $ANTLR start "entryRulePath"
// InternalExBeeLangTestLanguageParser.g:1407:1: entryRulePath returns [String current=null] : iv_rulePath= rulePath EOF ;
public final String entryRulePath() throws RecognitionException {
String current = null;
int entryRulePath_StartIndex = input.index();
AntlrDatatypeRuleToken iv_rulePath = null;
HiddenTokens myHiddenTokenState = ((XtextTokenStream) input).setHiddenTokens();
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 13)) {
return current;
}
// InternalExBeeLangTestLanguageParser.g:1409:2: (iv_rulePath= rulePath EOF )
// InternalExBeeLangTestLanguageParser.g:1410:2: iv_rulePath= rulePath EOF
{
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getPathRule());
}
pushFollow(FollowSets000.FOLLOW_1);
iv_rulePath = rulePath();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current = iv_rulePath.getText();
}
match(input, EOF, FollowSets000.FOLLOW_2);
if (state.failed)
return current;
}
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
if (state.backtracking > 0) {
memoize(input, 13, entryRulePath_StartIndex);
}
myHiddenTokenState.restore();
}
return current;
}
use of org.eclipse.xtext.parser.antlr.XtextTokenStream in project xtext-core by eclipse.
the class InternalBeeLangTestLanguageParser method rulePath.
// $ANTLR end "entryRulePath"
// $ANTLR start "rulePath"
// InternalBeeLangTestLanguage.g:1398:1: rulePath returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) ) ;
public final AntlrDatatypeRuleToken rulePath() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
int rulePath_StartIndex = input.index();
Token this_STRING_0 = null;
Token kw = null;
AntlrDatatypeRuleToken this_QID_2 = null;
AntlrDatatypeRuleToken this_QID_4 = null;
enterRule();
HiddenTokens myHiddenTokenState = ((XtextTokenStream) input).setHiddenTokens();
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 12)) {
return current;
}
// InternalBeeLangTestLanguage.g:1405:2: ( (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) ) )
// InternalBeeLangTestLanguage.g:1406:2: (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) )
{
// InternalBeeLangTestLanguage.g:1406:2: (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) )
int alt25 = 2;
int LA25_0 = input.LA(1);
if ((LA25_0 == RULE_STRING)) {
alt25 = 1;
} else if ((LA25_0 == RULE_ID || LA25_0 == 32)) {
alt25 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return current;
}
NoViableAltException nvae = new NoViableAltException("", 25, 0, input);
throw nvae;
}
switch(alt25) {
case 1:
// InternalBeeLangTestLanguage.g:1407:3: this_STRING_0= RULE_STRING
{
this_STRING_0 = (Token) match(input, RULE_STRING, FOLLOW_2);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_STRING_0);
}
if (state.backtracking == 0) {
newLeafNode(this_STRING_0, grammarAccess.getPathAccess().getSTRINGTerminalRuleCall_0());
}
}
break;
case 2:
// InternalBeeLangTestLanguage.g:1415:3: ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? )
{
// InternalBeeLangTestLanguage.g:1415:3: ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? )
// InternalBeeLangTestLanguage.g:1416:4: (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )?
{
// InternalBeeLangTestLanguage.g:1416:4: (kw= '/' )?
int alt22 = 2;
int LA22_0 = input.LA(1);
if ((LA22_0 == 32)) {
alt22 = 1;
}
switch(alt22) {
case 1:
// InternalBeeLangTestLanguage.g:1417:5: kw= '/'
{
kw = (Token) match(input, 32, FOLLOW_13);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_0());
}
}
break;
}
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getPathAccess().getQIDParserRuleCall_1_1());
}
pushFollow(FOLLOW_25);
this_QID_2 = ruleQID();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_QID_2);
}
if (state.backtracking == 0) {
afterParserOrEnumRuleCall();
}
// InternalBeeLangTestLanguage.g:1433:4: (kw= '/' this_QID_4= ruleQID )*
loop23: do {
int alt23 = 2;
int LA23_0 = input.LA(1);
if ((LA23_0 == 32)) {
int LA23_1 = input.LA(2);
if ((LA23_1 == RULE_ID)) {
alt23 = 1;
}
}
switch(alt23) {
case 1:
// InternalBeeLangTestLanguage.g:1434:5: kw= '/' this_QID_4= ruleQID
{
kw = (Token) match(input, 32, FOLLOW_13);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_2_0());
}
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getPathAccess().getQIDParserRuleCall_1_2_1());
}
pushFollow(FOLLOW_25);
this_QID_4 = ruleQID();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_QID_4);
}
if (state.backtracking == 0) {
afterParserOrEnumRuleCall();
}
}
break;
default:
break loop23;
}
} while (true);
// InternalBeeLangTestLanguage.g:1450:4: (kw= '/' )?
int alt24 = 2;
int LA24_0 = input.LA(1);
if ((LA24_0 == 32)) {
alt24 = 1;
}
switch(alt24) {
case 1:
// InternalBeeLangTestLanguage.g:1451:5: kw= '/'
{
kw = (Token) match(input, 32, FOLLOW_2);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_3());
}
}
break;
}
}
}
break;
}
}
if (state.backtracking == 0) {
leaveRule();
}
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
if (state.backtracking > 0) {
memoize(input, 12, rulePath_StartIndex);
}
myHiddenTokenState.restore();
}
return current;
}
use of org.eclipse.xtext.parser.antlr.XtextTokenStream in project xtext-core by eclipse.
the class InternalSimpleBeeLangTestLanguageParser method rulePath.
// $ANTLR end "entryRulePath"
// $ANTLR start "rulePath"
// InternalSimpleBeeLangTestLanguage.g:1426:1: rulePath returns [AntlrDatatypeRuleToken current=new AntlrDatatypeRuleToken()] : (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) ) ;
public final AntlrDatatypeRuleToken rulePath() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
int rulePath_StartIndex = input.index();
Token this_STRING_0 = null;
Token kw = null;
AntlrDatatypeRuleToken this_QID_2 = null;
AntlrDatatypeRuleToken this_QID_4 = null;
enterRule();
HiddenTokens myHiddenTokenState = ((XtextTokenStream) input).setHiddenTokens();
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 14)) {
return current;
}
// InternalSimpleBeeLangTestLanguage.g:1433:2: ( (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) ) )
// InternalSimpleBeeLangTestLanguage.g:1434:2: (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) )
{
// InternalSimpleBeeLangTestLanguage.g:1434:2: (this_STRING_0= RULE_STRING | ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? ) )
int alt25 = 2;
int LA25_0 = input.LA(1);
if ((LA25_0 == RULE_STRING)) {
alt25 = 1;
} else if ((LA25_0 == RULE_ID || LA25_0 == 32)) {
alt25 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return current;
}
NoViableAltException nvae = new NoViableAltException("", 25, 0, input);
throw nvae;
}
switch(alt25) {
case 1:
// InternalSimpleBeeLangTestLanguage.g:1435:3: this_STRING_0= RULE_STRING
{
this_STRING_0 = (Token) match(input, RULE_STRING, FollowSets000.FOLLOW_2);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_STRING_0);
}
if (state.backtracking == 0) {
newLeafNode(this_STRING_0, grammarAccess.getPathAccess().getSTRINGTerminalRuleCall_0());
}
}
break;
case 2:
// InternalSimpleBeeLangTestLanguage.g:1443:3: ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? )
{
// InternalSimpleBeeLangTestLanguage.g:1443:3: ( (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )? )
// InternalSimpleBeeLangTestLanguage.g:1444:4: (kw= '/' )? this_QID_2= ruleQID (kw= '/' this_QID_4= ruleQID )* (kw= '/' )?
{
// InternalSimpleBeeLangTestLanguage.g:1444:4: (kw= '/' )?
int alt22 = 2;
int LA22_0 = input.LA(1);
if ((LA22_0 == 32)) {
alt22 = 1;
}
switch(alt22) {
case 1:
// InternalSimpleBeeLangTestLanguage.g:1445:5: kw= '/'
{
kw = (Token) match(input, 32, FollowSets000.FOLLOW_13);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_0());
}
}
break;
}
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getPathAccess().getQIDParserRuleCall_1_1());
}
pushFollow(FollowSets000.FOLLOW_25);
this_QID_2 = ruleQID();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_QID_2);
}
if (state.backtracking == 0) {
afterParserOrEnumRuleCall();
}
// InternalSimpleBeeLangTestLanguage.g:1461:4: (kw= '/' this_QID_4= ruleQID )*
loop23: do {
int alt23 = 2;
int LA23_0 = input.LA(1);
if ((LA23_0 == 32)) {
int LA23_1 = input.LA(2);
if ((LA23_1 == RULE_ID)) {
alt23 = 1;
}
}
switch(alt23) {
case 1:
// InternalSimpleBeeLangTestLanguage.g:1462:5: kw= '/' this_QID_4= ruleQID
{
kw = (Token) match(input, 32, FollowSets000.FOLLOW_13);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_2_0());
}
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getPathAccess().getQIDParserRuleCall_1_2_1());
}
pushFollow(FollowSets000.FOLLOW_25);
this_QID_4 = ruleQID();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(this_QID_4);
}
if (state.backtracking == 0) {
afterParserOrEnumRuleCall();
}
}
break;
default:
break loop23;
}
} while (true);
// InternalSimpleBeeLangTestLanguage.g:1478:4: (kw= '/' )?
int alt24 = 2;
int LA24_0 = input.LA(1);
if ((LA24_0 == 32)) {
alt24 = 1;
}
switch(alt24) {
case 1:
// InternalSimpleBeeLangTestLanguage.g:1479:5: kw= '/'
{
kw = (Token) match(input, 32, FollowSets000.FOLLOW_2);
if (state.failed)
return current;
if (state.backtracking == 0) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getPathAccess().getSolidusKeyword_1_3());
}
}
break;
}
}
}
break;
}
}
if (state.backtracking == 0) {
leaveRule();
}
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
if (state.backtracking > 0) {
memoize(input, 14, rulePath_StartIndex);
}
myHiddenTokenState.restore();
}
return current;
}
use of org.eclipse.xtext.parser.antlr.XtextTokenStream in project xtext-core by eclipse.
the class InternalExBeeLangTestLanguageParser method entryRuleQID.
// $ANTLR end "ruleParanthesizedExpression"
// $ANTLR start "entryRuleQID"
// InternalExBeeLangTestLanguageParser.g:5405:1: entryRuleQID returns [String current=null] : iv_ruleQID= ruleQID EOF ;
public final String entryRuleQID() throws RecognitionException {
String current = null;
int entryRuleQID_StartIndex = input.index();
AntlrDatatypeRuleToken iv_ruleQID = null;
HiddenTokens myHiddenTokenState = ((XtextTokenStream) input).setHiddenTokens();
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 113)) {
return current;
}
// InternalExBeeLangTestLanguageParser.g:5407:2: (iv_ruleQID= ruleQID EOF )
// InternalExBeeLangTestLanguageParser.g:5408:2: iv_ruleQID= ruleQID EOF
{
if (state.backtracking == 0) {
newCompositeNode(grammarAccess.getQIDRule());
}
pushFollow(FollowSets000.FOLLOW_1);
iv_ruleQID = ruleQID();
state._fsp--;
if (state.failed)
return current;
if (state.backtracking == 0) {
current = iv_ruleQID.getText();
}
match(input, EOF, FollowSets000.FOLLOW_2);
if (state.failed)
return current;
}
} catch (RecognitionException re) {
recover(input, re);
appendSkippedTokens();
} finally {
if (state.backtracking > 0) {
memoize(input, 113, entryRuleQID_StartIndex);
}
myHiddenTokenState.restore();
}
return current;
}
use of org.eclipse.xtext.parser.antlr.XtextTokenStream in project xtext-xtend by eclipse.
the class FlexingTest method assertLexing.
@Override
protected void assertLexing(String input, Pair<String, String>... expectedTokens) {
FlexTokenSource tokenSource = new FlexerFactory().createTokenSource(new StringReader(input));
XtextTokenStream tokenStream = new XtextTokenStream(tokenSource, getTokenDefProvider());
List<?> tokens = tokenStream.getTokens();
assertEquals(input + " / " + tokens, expectedTokens.length, tokens.size());
for (int i = 0; i < tokens.size(); i++) {
Token token = (Token) tokens.get(i);
assertEquals(token.toString(), expectedTokens[i].getFirst(), token.getText());
final String expected = expectedTokens[i].getSecond();
String actual = getTokenDefProvider().getTokenDefMap().get(token.getType());
assertEquals("expected " + expected + " but was " + actual, expected, actual);
}
}
Aggregations