本文整理汇总了C#中TokenKind类的典型用法代码示例。如果您正苦于以下问题:C# TokenKind类的具体用法?C# TokenKind怎么用?C# TokenKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TokenKind类属于命名空间,在下文中一共展示了TokenKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnexpectedTokenException
public UnexpectedTokenException(Token current, TokenKind[] tokenKinds)
: base(string.Format("On line {0} expected {1} but got {2}.",
current.Line, string.Join(",",tokenKinds), current.Kind ))
{
EncounteredToken = current;
ExpectedTokenKinds = tokenKinds;
}
示例2: BinaryExpression
public BinaryExpression(int line, int col, Expression lhs, TokenKind op, Expression rhs)
: base(line, col)
{
this.lhs = lhs;
this.rhs = rhs;
this.op = op;
}
示例3: BinaryOperatorTerminal
public BinaryOperatorTerminal(string @operator, TokenKind tokenKind)
: base("-" + @operator, "(?<_operator_" + @operator + ">" + dash_pattern + @operator + ")")
{
this.Operator = @operator;
this.TokenKind = tokenKind;
Priority = TerminalPriority.ReservedWords;
}
示例4: Token
public Token(TokenKind kind, string text, int line, int column)
{
this.kind = kind;
this.line = line;
this.column = column;
this.text = text;
}
示例5: Token
public Token(TokenKind kind, string value, int line, int column)
{
this.kind = kind;
this.value = value;
this.line = line;
this.column = column;
}
示例6: Reset
public void Reset()
{
this.kind = TokenKind.EOF;
this.text = string.Empty;
this.value = -1L;
this.pos = -1;
}
示例7: AssignmentStatementAst
public AssignmentStatementAst(IScriptExtent extent, ExpressionAst left, TokenKind @operator, StatementAst right, IScriptExtent errorPosition) : base(extent)
{
if (((left == null) || (right == null)) || (errorPosition == null))
{
throw PSTraceSource.NewArgumentNullException((left == null) ? "left" : ((right == null) ? "right" : "errorPosition"));
}
if ((@operator.GetTraits() & TokenFlags.AssignmentOperator) == TokenFlags.None)
{
throw PSTraceSource.NewArgumentException("operator");
}
PipelineAst ast = right as PipelineAst;
if ((ast != null) && (ast.PipelineElements.Count == 1))
{
CommandExpressionAst ast2 = ast.PipelineElements[0] as CommandExpressionAst;
if (ast2 != null)
{
right = ast2;
right.ClearParent();
}
}
this.Operator = @operator;
this.Left = left;
base.SetParent(left);
this.Right = right;
base.SetParent(right);
this.ErrorPosition = errorPosition;
}
示例8: Match
private Token Match(TokenKind kind)
{
if (_lookahead.Kind == kind)
return ReadToken();
throw new ParserError(_lookahead.Position, "Expected '" + kind.ToString() + "', found '" + _lookahead.ToString() + "'");
}
示例9: SetIsCommandArgument
internal void SetIsCommandArgument()
{
if (this._kind != TokenKind.Identifier)
{
this._kind = TokenKind.Generic;
}
}
示例10: TokenKindTests
public TokenKindTests()
{
lower = new Pattern("Lowercase", @"[a-z]+");
upper = new Pattern("Uppercase", @"[A-Z]+");
caseInsensitive = new Pattern("Case Insensitive", @"[a-z]+", RegexOptions.IgnoreCase);
abcDEF = new Text("abcDEF");
}
示例11: Token
/// <summary>
/// 初始化 Token 对象。
/// </summary>
/// <param name="kind">指定 Token 类型。</param>
/// <param name="data">指定 Token 内容。</param>
/// <param name="line">指定 Token 所在的行数</param>
/// <param name="col">指定 Token 所在的列数</param>
public Token(TokenKind kind, string data, int line, int col)
{
_TokenKind = kind;
_Line = line;
_Col = col;
_Data = data;
}
示例12: Token
public Token(TokenKind kind, string data, int line, int col)
{
_tokenKind = kind;
_line = line;
_col = col;
_data = data;
}
示例13: Token
public Token(TokenKind kind, string data, int line, int col)
{
this.TokenKind = kind;
this.Data = data;
this.Line = line;
this.Col = col;
}
示例14: Token
public Token(int line, int col, string data,TokenKind tokenKind)
{
this.Line = line;
this.Col = col;
this.Text = data;
this.Kind = tokenKind;
}
示例15: Ensure
public void Ensure(TokenKind kind, string readerName)
{
if (current.Kind != kind)
{
throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}.");
}
}