本文整理汇总了C#中Antlr.Runtime.IToken类的典型用法代码示例。如果您正苦于以下问题:C# Antlr.Runtime.IToken类的具体用法?C# Antlr.Runtime.IToken怎么用?C# Antlr.Runtime.IToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Antlr.Runtime.IToken类属于命名空间,在下文中一共展示了Antlr.Runtime.IToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GrammarSyntaxMessage
public GrammarSyntaxMessage( int msgID,
Grammar grammar,
IToken offendingToken,
RecognitionException exception )
: this(msgID, grammar, offendingToken, null, exception)
{
}
示例2: ErrorNode
/// <summary>
/// Create tree node that holds the start and stop tokens associated
/// with an error.
/// </summary>
/// <remarks>
/// <para>If you specify your own kind of tree nodes, you will likely have to
/// override this method. CommonTree returns Token.INVALID_TOKEN_TYPE
/// if no token payload but you might have to set token type for diff
/// node type.</para>
///
/// <para>You don't have to subclass CommonErrorNode; you will likely need to
/// subclass your own tree node class to avoid class cast exception.</para>
/// </remarks>
public virtual object ErrorNode(ITokenStream input, IToken start, IToken stop,
RecognitionException e)
{
CommonErrorNode t = new CommonErrorNode(input, start, stop, e);
//System.out.println("returning error node '"+t+"' @index="+input.index());
return t;
}
示例3: TemplateLexerMessage
IToken templateToken; // overall token pulled from group file
#endregion Fields
#region Constructors
public TemplateLexerMessage(string srcName, string msg, IToken templateToken, Exception cause)
: base(ErrorType.LEXER_ERROR, null, cause, null)
{
this.msg = msg;
this.templateToken = templateToken;
this.srcName = srcName;
}
示例4: TemplateCompiletimeMessage
public TemplateCompiletimeMessage(ErrorType error, string sourceName, IToken templateToken, IToken token, Exception cause, object arg, object arg2)
: base(error, null, cause, arg, arg2)
{
this._templateToken = templateToken;
this._token = token;
this._sourceName = sourceName;
}
示例5: TemplateLexerMessage
private readonly IToken _templateToken; // overall token pulled from group file
#endregion Fields
#region Constructors
public TemplateLexerMessage(string sourceName, string message, IToken templateToken, Exception cause)
: base(ErrorType.LEXER_ERROR, null, cause, null)
{
this._message = message;
this._templateToken = templateToken;
this._sourceName = sourceName;
}
示例6: GrammarSemanticsMessage
public GrammarSemanticsMessage( int msgID,
Grammar g,
IToken offendingToken,
object arg )
: this(msgID, g, offendingToken, arg, null)
{
}
示例7: ANTLRMessage
public ANTLRMessage([NotNull] ErrorType errorType, [Nullable] Exception e, IToken offendingToken, params object[] args)
{
this.errorType = errorType;
this.e = e;
this.args = args;
this.offendingToken = offendingToken;
}
示例8: ProcessNested
public virtual void ProcessNested(IToken actionToken)
{
ANTLRStringStream @in = new ANTLRStringStream(actionToken.Text);
@in.Line = actionToken.Line;
@in.CharPositionInLine = actionToken.CharPositionInLine;
ActionSplitter splitter = new ActionSplitter(@in, this);
// forces eval, triggers listener methods
splitter.GetActionTokens();
}
示例9: ActionSniffer
public ActionSniffer(Grammar g, Rule r, Alternative alt, ActionAST node, IToken actionToken)
{
this.g = g;
this.r = r;
this.alt = alt;
this.node = node;
this.actionToken = actionToken;
this.errMgr = g.tool.errMgr;
}
示例10: GrammarRootAST
public GrammarRootAST(int type, IToken t, string text, ITokenStream tokenStream)
: base(type, t, text)
{
if (tokenStream == null)
{
throw new ArgumentNullException(nameof(tokenStream));
}
this.tokenStream = tokenStream;
}
示例11: GrammarSemanticsMessage
public GrammarSemanticsMessage(ErrorType etype,
string fileName,
IToken offendingToken,
params object[] args)
: base(etype, offendingToken, args)
{
this.fileName = fileName;
if (offendingToken != null)
{
line = offendingToken.Line;
charPosition = offendingToken.CharPositionInLine;
}
}
示例12: TrackRef
public virtual void TrackRef(IToken x)
{
IList<TerminalAST> xRefs;
if (alt.tokenRefs.TryGetValue(x.Text, out xRefs) && xRefs != null)
{
alt.tokenRefsInActions.Map(x.Text, node);
}
IList<GrammarAST> rRefs;
if (alt.ruleRefs.TryGetValue(x.Text, out rRefs) && rRefs != null)
{
alt.ruleRefsInActions.Map(x.Text, node);
}
}
示例13: GrammarSyntaxMessage
public GrammarSyntaxMessage(ErrorType etype,
string fileName,
IToken offendingToken,
RecognitionException antlrException,
params object[] args)
: base(etype, antlrException, offendingToken, args)
{
this.fileName = fileName;
this.offendingToken = offendingToken;
if (offendingToken != null)
{
line = offendingToken.Line;
charPosition = offendingToken.CharPositionInLine;
}
}
示例14: TranslateAction
public static IList<ActionChunk> TranslateAction(OutputModelFactory factory,
RuleFunction rf,
IToken tokenWithinAction,
ActionAST node)
{
string action = tokenWithinAction.Text;
if (action != null && action.Length > 0 && action[0] == '{')
{
int firstCurly = action.IndexOf('{');
int lastCurly = action.LastIndexOf('}');
if (firstCurly >= 0 && lastCurly >= 0)
{
action = action.Substring(firstCurly + 1, lastCurly - firstCurly - 1); // trim {...}
}
}
return TranslateActionChunk(factory, rf, action, node);
}
示例15: SetTokenBoundaries
public abstract void SetTokenBoundaries(object param1, IToken param2, IToken param3);