List of usage examples for org.antlr.v4.runtime CommonToken setLine
@Override
public void setLine(int line)
From source file:info.fulloo.trygve.semantic_analysis.StaticScope.java
License:Open Source License
private static void reinitializeObject(final Type objectType, final StaticScope objectsScope) { final CommonToken objectToken = new CommonToken(0); objectToken.setLine(157239); final ClassDeclaration objectClass = new ClassDeclaration("Object", objectsScope, null, objectToken); globalScope_.declareClass(objectClass); objectClass.setType(objectType);/* w w w . j a v a2 s. c o m*/ objectsScope.setDeclaration(objectClass); typeDeclarationList_.add(objectClass); }
From source file:org.apache.sysml.parser.pydml.PydmlLexer.java
License:Apache License
private Token createDedent() { CommonToken dedent = commonToken(PydmlParser.DEDENT, ""); dedent.setLine(this.lastToken.getLine()); return dedent; }
From source file:org.eclipse.titan.designer.parsers.ttcn3parser.PPDirectiveTokenFactory.java
License:Open Source License
@Override public CommonToken create(Pair<TokenSource, CharStream> source, int type, String text, int channel, int start, int stop, int line, int charPositionInLine) { CommonToken t = new CommonToken(source, type, channel, start, stop); t.setLine(line); t.setStartIndex(start + token.getStartIndex()); t.setStopIndex(stop + token.getStartIndex() + 1); t.setCharPositionInLine(charPositionInLine); if (text != null) { t.setText(text);//w ww . ja v a2 s . c o m } else if (copyText && source.b != null) { t.setText(source.b.getText(Interval.of(start, stop))); } return t; }
From source file:shadow.typecheck.TypeUpdater.java
License:Apache License
private static Token makeDummyToken(Context node) { CommonToken token; if (node instanceof ShadowParser.ClassOrInterfaceDeclarationContext) token = new CommonToken( ((ShadowParser.ClassOrInterfaceDeclarationContext) node).Identifier().getSymbol()); else if (node instanceof ShadowParser.EnumDeclarationContext) token = new CommonToken(((ShadowParser.EnumDeclarationContext) node).Identifier().getSymbol()); else {//w w w. j a v a 2s. com token = new CommonToken(node.getStart()); //since the token is for a made-up create or property, it has no location in the file token.setLine(-1); token.setCharPositionInLine(-1); token.setStartIndex(0); token.setStopIndex(0); } return token; }