antlr.IToken CreateToken(antlr.IToken prototype, int newTokenType, string newTokenText) { return(new BooToken(newTokenType, newTokenText, prototype.getFilename(), prototype.getLine(), prototype.getColumn() + SafeGetLength(prototype.getText()))); }
public BooToken(antlr.IToken original, int type, string text) { setType(type); setText(text); setFilename(original.getFilename()); setLine(original.getLine()); setColumn(original.getColumn()); }
private Tuple <int, int> CalculateEndpoint(antlr.IToken token, int endLine, int endIndex, int delimiterLength) { var startIndex = positionMap[token.getLine() - 1][token.getColumn() - 1]; var startLine = token.getLine() - 1; if (startLine > endLine || startLine == endLine && startIndex > endIndex) { whitespaces.Add(new TextSpan { iStartLine = endLine, iStartIndex = endIndex, iEndLine = startLine, iEndIndex = startIndex }); } endLine = startLine - 1; endIndex = 0; var runningIndex = startIndex + delimiterLength; foreach (var part in token.getText().Split(new[] { "\r\n" }, StringSplitOptions.None)) { endLine++; endIndex = runningIndex + part.Length; runningIndex = 0; } endIndex += delimiterLength; //endIndex = positionMap[endLine][endIndex]; var cluster = new MappedToken( startLine * lineSize + startIndex, endIndex - startIndex); if (tokenMap.Count > 0 && tokenMap[tokenMap.Count() - 1].Index >= cluster.Index) { throw new ArgumentException("Token Mapping order"); } tokenMap.Add(cluster); return(new Tuple <int, int>(endLine, endIndex)); }
override public void initialize(IToken tok) { base.initialize(tok); Column = tok.getColumn(); Line = tok.getLine(); CustomHiddenStreamToken ctok = tok as CustomHiddenStreamToken; if (null != ctok) { File = ctok.File; } }
public int getLine() { return(iToken.getLine()); }
public override void initialize(IToken t) { base.initialize(t); line = t.getLine(); col = t.getColumn(); }
public static SourceLocation ToEndSourceLocation(antlr.IToken token) { string text = token.getText() ?? ""; return(new SourceLocation(token.getLine(), token.getColumn() + text.Length - 1)); }
public static SourceLocation ToSourceLocation(antlr.IToken token) { return(new SourceLocation(token.getLine(), token.getColumn())); }
public static LexicalInfo ToLexicalInfo(antlr.IToken token) { return(new LexicalInfo(token.getFilename(), token.getLine(), token.getColumn())); }
public static SourceLocation ToEndSourceLocation(antlr.IToken token) { return(new SourceLocation(token.getLine(), token.getColumn() + token.getText().Length - 1)); }