本文整理汇总了C#中Vici.Core.Parser.TokenPosition类的典型用法代码示例。如果您正苦于以下问题:C# TokenPosition类的具体用法?C# TokenPosition怎么用?C# TokenPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TokenPosition类属于Vici.Core.Parser命名空间,在下文中一共展示了TokenPosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConditionalExpression
public ConditionalExpression(TokenPosition position, Expression condition, Expression trueValue, Expression falseValue)
: base(position)
{
_condition = condition;
_trueValue = trueValue;
_falseValue = falseValue;
}
开发者ID:jcmm33,项目名称:core,代码行数:7,代码来源:ConditionalExpression.cs
示例2: GetPositionsFromString
public static TokenPosition[] GetPositionsFromString(string s, TokenPosition? basePosition)
{
TokenPosition[] positions = new TokenPosition[s.Length];
int currentLine = 1;
int currentColumn = 1;
for (int textIndex = 0; textIndex < s.Length; textIndex++)
{
char c = s[textIndex];
positions[textIndex].Line = currentLine;
positions[textIndex].Column = currentColumn;
if (basePosition != null)
positions[textIndex].ChangeBase(basePosition.Value);
if (c == '\n')
{
currentLine++;
currentColumn = 1;
}
else if (c != '\r')
currentColumn++;
}
return positions;
}
开发者ID:TheMouster,项目名称:core,代码行数:28,代码来源:TokenPosition.cs
示例3: ChangeBase
public void ChangeBase(TokenPosition basePosition)
{
if (Line <= 1)
Column = basePosition.Column + Column - 1;
Line = basePosition.Line + Line - 1;
}
开发者ID:TheMouster,项目名称:core,代码行数:7,代码来源:TokenPosition.cs
示例4: FieldExpression
/// <summary>
/// Create a field expression.
/// </summary>
/// <param name="position"></param>
/// <param name="target"></param>
/// <param name="member"></param>
/// <param name="generics">An optional collection of genericTypes</param>
public FieldExpression(TokenPosition position, Expression target, string member, Type[] genericTypes = null)
: base(position)
{
_target = target;
_member = member;
_genericTypes = genericTypes;
}
开发者ID:jcmm33,项目名称:core,代码行数:14,代码来源:FieldExpression.cs
示例5: FunctionCallToken
public FunctionCallToken(string text, TokenEvaluator evaluator, TokenPosition position) : base(text)
{
Precedence = 20;
TokenType = TokenType.FunctionCall;
Evaluator = evaluator;
TokenPosition = position;
}
开发者ID:TheMouster,项目名称:core,代码行数:7,代码来源:FunctionCallToken.cs
示例6: TokenPosition
public TokenPosition(TokenPosition parent, TokenPosition current) : this()
{
Line = parent.Line + current.Line - 1;
Column = current.Column;
if (current.Line <= 1)
Column = parent.Column + current.Column - 1;
}
开发者ID:TheMouster,项目名称:core,代码行数:9,代码来源:TokenPosition.cs
示例7: ValueExpression
public ValueExpression(TokenPosition position, object value, Type type)
: base(position)
{
Value = value;
Type = type;
if (Type == typeof(object) && Value != null)
Type = Value.GetType();
}
开发者ID:Niels-R,项目名称:core,代码行数:9,代码来源:ValueExpression.cs
示例8: TokenPosition
public TokenPosition(TokenPosition parent, TokenPosition current)
{
_line = parent.Line + current.Line - 1;
_column = current.Column;
if (current.Line <= 1)
_column = parent.Column + current.Column - 1;
}
开发者ID:stefandevo,项目名称:core,代码行数:9,代码来源:TokenPosition.cs
示例9: DotOperator
public static Expression DotOperator(string token, TokenPosition position, Expression[] terms)
{
VariableExpression varExpression = terms[1] as VariableExpression;
if (varExpression == null)
throw new UnknownPropertyException("Unkown member " + terms[1], terms[1]);
return new FieldExpression(position, terms[0], varExpression.VarName);
}
开发者ID:Niels-R,项目名称:core,代码行数:9,代码来源:CSharpEvaluator.cs
示例10: IsAsOperator
public static Expression IsAsOperator(string token, TokenPosition position, Expression[] terms)
{
if (token == "as")
return new AsExpression(position, terms[0], terms[1]);
if (token == "is")
return new IsExpression(position, terms[0], terms[1]);
return null;
}
开发者ID:TheMouster,项目名称:core,代码行数:10,代码来源:CSharpEvaluator.cs
示例11: UnEscape
private static char UnEscape(string s, TokenPosition position)
{
if (s.Length == 1)
return s[0];
if (s.Length == 2)
{
switch (s[1])
{
case '\\':
case '\"':
case '\'':
return s[1];
case '0':
return (char)0;
case 'a':
return '\a';
case 'b':
return '\b';
case 'f':
return '\f';
case 'n':
return '\n';
case 'r':
return '\r';
case 't':
return '\t';
case 'v':
return '\v';
default:
throw new UnknownTokenException(position,s);
}
}
else
{
return (char)Convert.ToUInt16(s.Substring(2), 16);
}
}
开发者ID:TheMouster,项目名称:core,代码行数:38,代码来源:CSharpEvaluator.cs
示例12: ReturnExpression
public ReturnExpression(TokenPosition tokenPosition, Expression expression) : base(tokenPosition, expression)
{
}
开发者ID:TheMouster,项目名称:core,代码行数:3,代码来源:ReturnExpression.cs
示例13: UnknownTokenException
public UnknownTokenException(TokenPosition position, string token)
: base(position,token)
{
}
开发者ID:stefandevo,项目名称:core,代码行数:4,代码来源:UnknownTokenException.cs
示例14: AddExpression
public AddExpression(TokenPosition position, Expression left, Expression right) : base(position, "+", left, right) { }
开发者ID:TheMouster,项目名称:core,代码行数:1,代码来源:AddExpression.cs
示例15: ConstructorExpression
public ConstructorExpression(TokenPosition position, VariableExpression className, Expression[] parameters)
: base(position)
{
_className = className;
_parameters = parameters;
}
开发者ID:jcmm33,项目名称:core,代码行数:6,代码来源:ConstructorExpression.cs
示例16: IfExpression
public IfExpression(TokenPosition position, Expression condition)
: base(position)
{
Condition = condition;
}
开发者ID:rmboggs,项目名称:core,代码行数:5,代码来源:IfExpression.cs
示例17: MultiplyExpression
public MultiplyExpression(TokenPosition position, Expression left, Expression right)
: base(position, "*", left, right)
{
}
开发者ID:Niels-R,项目名称:core,代码行数:4,代码来源:MultiplyExpression.cs
示例18: InOperator
public static Expression InOperator(string token, TokenPosition position, Expression[] terms)
{
VariableExpression varExpression = terms[0] as VariableExpression;
return new InExpression(position, varExpression, terms[1]);
}
开发者ID:TheMouster,项目名称:core,代码行数:6,代码来源:CSharpEvaluator.cs
示例19: BinaryArithmicExpression
public BinaryArithmicExpression(TokenPosition position, string op, Expression left, Expression right)
: base(position, left, right)
{
_operator = op;
}
开发者ID:stefandevo,项目名称:core,代码行数:5,代码来源:BinaryArithmicExpression.cs
示例20: Ternary
public static Expression Ternary(string token, TokenPosition position, Expression[] terms)
{
return new ConditionalExpression(position, terms[0], terms[1], terms[2]);
}
开发者ID:TheMouster,项目名称:core,代码行数:4,代码来源:CSharpEvaluator.cs
注:本文中的Vici.Core.Parser.TokenPosition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论