本文整理汇总了C#中JSToken类的典型用法代码示例。如果您正苦于以下问题:C# JSToken类的具体用法?C# JSToken怎么用?C# JSToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSToken类属于命名空间,在下文中一共展示了JSToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JSKeyword
private JSKeyword(JSToken token, string name, JSKeyword next)
{
this.name = name;
this.next = next;
this.token = token;
this.length = this.name.Length;
}
示例2: JSKeyword
private JSKeyword(JSToken token, string name, JSKeyword next)
{
m_name = name;
m_token = token;
m_length = m_name.Length;
m_next = next;
}
示例3: DoOp
// Evaluate a numeric binary operator on two values.
public static Object DoOp(Object v1, Object v2, JSToken operatorTok)
{
double n1 = Convert.ToNumber(v1);
double n2 = Convert.ToNumber(v2);
switch(operatorTok)
{
case JSToken.Minus:
{
return (n1 - n2);
}
// Not reached.
case JSToken.Multiply:
{
return (n1 * n2);
}
// Not reached.
case JSToken.Divide:
{
return (n1 / n2);
}
// Not reached.
case JSToken.Modulo:
{
return (n1 % n2);
}
// Not reached.
}
throw new JScriptException(JSError.InternalError);
}
示例4: BinaryOp
internal BinaryOp (AST parent, AST left, AST right, JSToken op, Location location)
: base (parent, location)
{
operand1 = left;
operand2 = right;
operatorTok = op;
}
示例5: while
/*internal bool Exists(string target)
{
JSKeyword keyword = this;
while (keyword != null)
{
if (keyword.m_name == target)
{
return true;
}
keyword = keyword.m_next;
}
return false;
}*/
internal static string CanBeIdentifier(JSToken keyword)
{
switch (keyword)
{
// always allowed
case JSToken.Get: return "get";
case JSToken.Set: return "set";
// not in strict mode
case JSToken.Implements: return "implements";
case JSToken.Interface: return "interface";
case JSToken.Let: return "let";
case JSToken.Package: return "package";
case JSToken.Private: return "private";
case JSToken.Protected: return "protected";
case JSToken.Public: return "public";
case JSToken.Static: return "static";
case JSToken.Yield: return "yield";
// apparently never allowed for Chrome, so we want to treat it
// differently, too
case JSToken.Native: return "native";
// no other tokens can be identifiers
default: return null;
}
}
示例6: PostOrPrefixOperator
internal PostOrPrefixOperator(AST parent, AST operand, JSToken oper, bool prefix, Location location)
: base(parent, location)
{
this.operand = operand;
this.oper = oper;
this.prefix = prefix;
}
示例7: UnaryOperator
protected UnaryOperator(Context context, JSParser parser, AstNode operand, JSToken operatorToken)
: base(context, parser)
{
Operand = operand;
OperatorToken = operatorToken;
if (Operand != null) Operand.Parent = this;
}
示例8: JSScanner
//public Dictionary<JSToken, int> TokenCounts;
public JSScanner(Context sourceContext)
{
m_keywords = s_Keywords;
m_previousToken = JSToken.None;
EatUnnecessaryCCOn = true;
UsePreprocessorDefines = true;
SetSource(sourceContext);
}
示例9: DoOp
private static object DoOp(long x, long y, JSToken operatorTok)
{
switch (operatorTok)
{
case JSToken.Multiply:
if ((x != 0L) && (y != 0L))
{
try
{
return (x * y);
}
catch (OverflowException)
{
return (x * y);
}
}
return (x * y);
case JSToken.Divide:
return (((double) x) / ((double) y));
case JSToken.Modulo:
if (y != 0L)
{
long num2 = x % y;
if (num2 != 0L)
{
return num2;
}
if (x < 0L)
{
if (y < 0L)
{
return 0;
}
return 0.0;
}
if (y < 0L)
{
return 0.0;
}
return 0;
}
return (double) 1.0 / (double) 0.0;
case JSToken.Minus:
{
long num = x - y;
if ((num < x) == (y > 0L))
{
return num;
}
return (x - y);
}
}
throw new JScriptException(JSError.InternalError);
}
示例10: BinaryOp
internal BinaryOp(Context context, AST operand1, AST operand2, JSToken operatorTok)
: base(context) {
this.operand1 = operand1;
this.operand2 = operand2;
this.operatorTok = operatorTok;
this.type1 = null;
this.type2 = null;
this.operatorMeth = null;
}
示例11: Context
// Constructors.
internal Context(String source)
{
startPosition = 0;
endPosition = source.Length;
startLine = 1;
startLinePosition = 0;
endLine = 1;
endLinePosition = 0;
token = JSToken.None;
this.source = source;
}
示例12: Context
public Context(DocumentContext document, int startLineNumber, int startLinePosition, int startPosition, int endLineNumber, int endLinePosition, int endPosition, JSToken token)
: this(document)
{
StartLineNumber = startLineNumber;
StartLinePosition = startLinePosition;
StartPosition = startPosition;
EndLineNumber = endLineNumber;
EndLinePosition = endLinePosition;
EndPosition = endPosition;
Token = token;
}
示例13: Context
internal Context(DocumentContext document, String source_string){
this.document = document;
this.source_string = source_string;
this.lineNumber = 1;
this.startLinePos = 0;
this.startPos = 0;
this.endLineNumber = 1;
this.endLinePos = 0;
this.endPos = (source_string == null) ? -1 : source_string.Length;
this.token = JSToken.None;
this.errorReported = 1000000;
}
示例14: Context
internal Context(DocumentContext document, string source_string, int lineNumber, int startLinePos, int startPos, int endLineNumber, int endLinePos, int endPos, JSToken token)
{
this.document = document;
this.source_string = source_string;
this.lineNumber = lineNumber;
this.startLinePos = startLinePos;
this.startPos = startPos;
this.endLineNumber = endLineNumber;
this.endLinePos = endLinePos;
this.endPos = endPos;
this.token = token;
this.errorReported = 0xf4240;
}
示例15: Context
public Context(DocumentContext document, int lineNumber, int startLinePos, int startPos, int endLineNumber,
int endLinePos, int endPos, JSToken token)
{
Document = document;
StartLineNumber = lineNumber;
StartLinePosition = startLinePos;
StartPosition = startPos;
EndLineNumber = endLineNumber;
EndLinePosition = endLinePos;
EndPosition = endPos;
Token = token;
m_errorReported = 1000000;
}