本文整理汇总了C#中Antlr.Runtime.IToken类的典型用法代码示例。如果您正苦于以下问题:C# Antlr.Runtime.IToken类的具体用法?C# Antlr.Runtime.IToken怎么用?C# Antlr.Runtime.IToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Antlr.Runtime.IToken类属于命名空间,在下文中一共展示了Antlr.Runtime.IToken类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GrammarSyntaxMessage
public GrammarSyntaxMessage( int msgID,
Grammar grammar,
IToken offendingToken,
RecognitionException exception )
: this(msgID, grammar, offendingToken, null, exception)
{
}
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:7,代码来源:GrammarSyntaxMessage.cs
示例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;
}
开发者ID:Fedorm,项目名称:core-master,代码行数:20,代码来源:BaseTreeAdaptor.cs
示例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;
}
开发者ID:JSchofield,项目名称:antlrcs,代码行数:13,代码来源:TemplateLexerMessage.cs
示例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;
}
开发者ID:antlr,项目名称:antlrcs,代码行数:7,代码来源:TemplateCompileTimeMessage.cs
示例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;
}
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:13,代码来源:TemplateLexerMessage.cs
示例6: GrammarSemanticsMessage
public GrammarSemanticsMessage( int msgID,
Grammar g,
IToken offendingToken,
object arg )
: this(msgID, g, offendingToken, arg, null)
{
}
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:7,代码来源:GrammarSemanticsMessage.cs
示例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;
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:7,代码来源:ANTLRMessage.cs
示例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();
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:9,代码来源:ActionSniffer.cs
示例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;
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:9,代码来源:ActionSniffer.cs
示例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;
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:10,代码来源:GrammarRootAST.cs
示例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;
}
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:13,代码来源:GrammarSemanticsMessage.cs
示例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);
}
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:14,代码来源:ActionSniffer.cs
示例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;
}
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:15,代码来源:GrammarSyntaxMessage.cs
示例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);
}
开发者ID:sharwell,项目名称:antlr4cs,代码行数:18,代码来源:ActionTranslator.cs
示例15: SetTokenBoundaries
public abstract void SetTokenBoundaries(object param1, IToken param2, IToken param3);
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:1,代码来源:BaseTreeAdaptor.cs
示例16: CreateToken
/// <summary>
/// Tell me how to create a token for use with imaginary token nodes.
/// For example, there is probably no input symbol associated with imaginary
/// token DECL, but you need to create it as a payload or whatever for
/// the DECL node as in ^(DECL type ID).
///
/// This is a variant of createToken where the new token is derived from
/// an actual real input token. Typically this is for converting '{'
/// tokens to BLOCK etc... You'll see
///
/// r : lc='{' ID+ '}' -> ^(BLOCK[$lc] ID+) ;
///
/// If you care what the token payload objects' type is, you should
/// override this method and any other createToken variant.
/// </summary>
public abstract IToken CreateToken(IToken fromToken);
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:16,代码来源:BaseTreeAdaptor.cs
示例17: Create
public abstract object Create(IToken param1);
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:1,代码来源:BaseTreeAdaptor.cs
示例18: BecomeRoot
public virtual object BecomeRoot(IToken newRoot, object oldRoot)
{
return BecomeRoot(Create(newRoot), oldRoot);
}
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:4,代码来源:BaseTreeAdaptor.cs
示例19: SerializeToken
protected internal virtual string SerializeToken(IToken t)
{
StringBuilder buf = new StringBuilder(50);
buf.Append(t.TokenIndex); buf.Append('\t');
buf.Append(t.Type); buf.Append('\t');
buf.Append(t.Channel); buf.Append('\t');
buf.Append(t.Line); buf.Append('\t');
buf.Append(t.CharPositionInLine);
SerializeText(buf, t.Text);
return buf.ToString();
}
开发者ID:Fedorm,项目名称:core-master,代码行数:11,代码来源:DebugEventSocketProxy.cs
示例20: CreateNode
public override void CreateNode(object node, IToken token)
{
int ID = adaptor.GetUniqueID(node);
int tokenIndex = token.TokenIndex;
Transmit("createNode\t" + ID + "\t" + tokenIndex);
}
开发者ID:Fedorm,项目名称:core-master,代码行数:6,代码来源:DebugEventSocketProxy.cs
注:本文中的Antlr.Runtime.IToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论