本文整理汇总了C#中DDW.Token类的典型用法代码示例。如果您正苦于以下问题:C# Token类的具体用法?C# Token怎么用?C# Token使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Token类属于DDW命名空间,在下文中一共展示了Token类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: Error
public Error(string message, Token token, int line, int column, string fileName)
{
Message = message;
Token = token;
Line = line;
Column = column;
FileName = fileName;
}
示例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)
//{
//}
}
示例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");
}
}
示例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;
}
示例6: ThisAccessExpression
public ThisAccessExpression(Token relatedToken): base(relatedToken)
{
identifier = "this";
}
示例7: LabeledStatement
public LabeledStatement(Token relatedtoken)
: base(relatedtoken)
{
}
示例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;
}
示例9: EventNode
public EventNode(Token relatedtoken)
: base(relatedtoken)
{
}
示例10: StackallocExpression
public StackallocExpression(Token relatedToken)
: base(relatedToken)
{
}
示例11: ObjectCreationExpression
public ObjectCreationExpression(IType type, Token relatedToken)
: base(relatedToken)
{
this.type = type;
}
示例12: SizeOfExpression
public SizeOfExpression(Token relatedToken)
: base(relatedToken)
{
}
示例13: AnonymousMethodNode
public AnonymousMethodNode(Token relatedtoken)
: base(relatedtoken)
{
statementBlock = new BlockStatement(relatedtoken);
}
示例14: BreakStatement
public BreakStatement(Token relatedtoken)
: base(relatedtoken)
{
}
示例15: BlockStatement
public BlockStatement(bool isUnsafe, Token relatedtoken) : base(relatedtoken)
{
this.IsUnsafe = isUnsafe;
}