本文整理汇总了C#中DDW.Token类的典型用法代码示例。如果您正苦于以下问题:C# Token类的具体用法?C# Token怎么用?C# Token使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Token类属于DDW命名空间,在下文中一共展示了Token类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RealPrimitive
public RealPrimitive(string value, Token relatedToken)
: base(relatedToken)
{
originalString = value;
char c = value[value.Length - 1];
switch(c)
{
case 'f':
case 'F':
isFloat = true;
value = value.Substring(0, value.Length - 1);
val = float.Parse(value, CultureInfo.InvariantCulture);
break;
case 'd':
case 'D':
isDouble = true;
value = value.Substring(0, value.Length - 1);
val = double.Parse(value, CultureInfo.InvariantCulture);
break;
case 'm':
case 'M':
isDecimal = true;
value = value.Substring(0, value.Length - 1);
val = (double)decimal.Parse(value, CultureInfo.InvariantCulture);
break;
default:
val = double.Parse(value, CultureInfo.InvariantCulture);
break;
}
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:30,代码来源:RealPrimitive.cs
示例2: Error
public Error(string message, Token token, int line, int column, string fileName)
{
Message = message;
Token = token;
Line = line;
Column = column;
FileName = fileName;
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:8,代码来源:Parser.cs
示例3: IntegralPrimitive
public IntegralPrimitive(string value, IntegralType integralType, Token relatedToken) : base(relatedToken)
{
this.originalString = value;
this.integralType = integralType;
switch (integralType)
{
case IntegralType.SByte:
case IntegralType.Byte:
case IntegralType.Short:
case IntegralType.Int:
break;
case IntegralType.UShort:
value = value.TrimEnd('U', 'u');
break;
case IntegralType.UInt:
value = value.TrimEnd('U', 'u');
break;
case IntegralType.Long:
value = value.TrimEnd('L', 'l');
break;
case IntegralType.ULong:
value = value.TrimEnd('L', 'l', 'U', 'u');
value = value.TrimEnd('L', 'l', 'U', 'u');
break;
default:
throw new FormatException("Illegal Integral type");
}
int radix = 10;
NumberStyles style = NumberStyles.Integer;
if (value.StartsWith("0x", true, CultureInfo.InvariantCulture))
{
radix = 16;
style = NumberStyles.HexNumber;
value = value.Substring(2, value.Length - 2);
}
// negation is wrapped in a unaryNegationNode so no need to account for negative values
//try
//{
this.value = UInt64.Parse(value, style);
//this.value = Convert.ToUInt64(value, radix);
//}
//catch (OverflowException)
//{
// ConsoleWr
//}
//catch (FormatException)
//{
//}
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:58,代码来源:IntegralPrimitive.cs
示例4: CharPrimitive
public CharPrimitive(string value, Token relatedToken)
: base(relatedToken)
{
if (value.Length == 1
|| value.Length == 2 && value.StartsWith("\\") )
{
this.value = value;
}
else
{
throw new FormatException("char primitive value is not a char");
}
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:13,代码来源:CharPrimitive.cs
示例5: GetLastTokenIDExceptBlanks
public Token GetLastTokenIDExceptBlanks()
{
LinkedListNode<Token> node = tokens.Last;
Token ret = new Token(TokenID.Invalid);
while (node != null
&& (node.Value.ID == TokenID.Whitespace || node.Value.ID == TokenID.Newline))
{
node = node.Previous;
}
if (node != null)
{
ret = node.Value;
}
return ret;
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:18,代码来源:Lexer.cs
示例6: ThisAccessExpression
public ThisAccessExpression(Token relatedToken): base(relatedToken)
{
identifier = "this";
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:ThisAccessExpression.cs
示例7: LabeledStatement
public LabeledStatement(Token relatedtoken)
: base(relatedtoken)
{
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:4,代码来源:LabeledStatement.cs
示例8: ClassNode
//private NodeCollection<FieldNode> members;
//public NodeCollection<FieldNode> Members
//{
// get { return members; }
// set { members = value; }
//}
public ClassNode(Token relatedToken) : base(relatedToken)
{
kind = ConstructedTypeNode.KindEnum.Class;
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:11,代码来源:ClassNode.cs
示例9: EventNode
public EventNode(Token relatedtoken)
: base(relatedtoken)
{
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:EventNode.cs
示例10: StackallocExpression
public StackallocExpression(Token relatedToken)
: base(relatedToken)
{
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:4,代码来源:StackallocExpression.cs
示例11: ObjectCreationExpression
public ObjectCreationExpression(IType type, Token relatedToken)
: base(relatedToken)
{
this.type = type;
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:5,代码来源:ObjectCreationExpression.cs
示例12: SizeOfExpression
public SizeOfExpression(Token relatedToken)
: base(relatedToken)
{
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:SizeOfExpression.cs
示例13: AnonymousMethodNode
public AnonymousMethodNode(Token relatedtoken)
: base(relatedtoken)
{
statementBlock = new BlockStatement(relatedtoken);
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:5,代码来源:AnonymousMethodNode.cs
示例14: BreakStatement
public BreakStatement(Token relatedtoken)
: base(relatedtoken)
{
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:4,代码来源:BreakStatement.cs
示例15: BlockStatement
public BlockStatement(bool isUnsafe, Token relatedtoken) : base(relatedtoken)
{
this.IsUnsafe = isUnsafe;
}
开发者ID:andyhebear,项目名称:Csharp-Parser,代码行数:4,代码来源:BlockStatement.cs
示例16: PredefinedTypeNode
public PredefinedTypeNode(TokenID type, Token relatedToken)
: base( new IdentifierExpression(type.ToString().ToLower(), relatedToken) )
{
this.type = type;
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:5,代码来源:PredefinedTypeNode.cs
示例17: OutNode
public OutNode(Token relatedToken)
: base(relatedToken)
{
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:OutNode.cs
示例18: SwitchStatement
public SwitchStatement(Token relatedtoken)
: base(relatedtoken)
{
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:SwitchStatement.cs
示例19: InterfaceMethodNode
public InterfaceMethodNode(Token relatedtoken)
: base(relatedtoken)
{
}
开发者ID:debreuil,项目名称:CSharpParser,代码行数:4,代码来源:InterfaceMethodNode.cs
示例20: DoStatement
public DoStatement(Token relatedToken)
: base(relatedToken)
{
statements = new BlockStatement(relatedToken);
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:5,代码来源:DoStatement.cs
注:本文中的DDW.Token类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论