Ejemplo n.º 1
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     if (lastToken is NewTypeToken || lastToken is TypeFunctionToken)
     {
         // TODO: Fix this problem, as if the method returns a Function, () won't work!
         return false;
     }
     return sourceCode.Matches("(");
 }
 private ComparisonOperatorToken.OperatorType GetType(ref SourceCode code)
 {
     ComparisonOperatorToken.OperatorType t = ComparisonOperatorToken.OperatorType.Equals;
     if (code.Matches("=="))
     {
         t = ComparisonOperatorToken.OperatorType.Equals;
         code += 2;
     }
     if (code.Matches("!="))
     {
         t = ComparisonOperatorToken.OperatorType.NotEquals;
         code += 2;
     }
     if (code.Matches("<="))
     {
         t = ComparisonOperatorToken.OperatorType.LessThanOrEqual;
         code += 2;
     }
     if (code.Matches("<"))
     {
         t = ComparisonOperatorToken.OperatorType.LessThan;
         code++;
     }
     if (code.Matches(">="))
     {
         t = ComparisonOperatorToken.OperatorType.GreaterThanOrEqual;
         code += 2;
     }
     if (code.Matches(">"))
     {
         t = ComparisonOperatorToken.OperatorType.GreaterThan;
         code++;
     }
     return t;
 }
Ejemplo n.º 3
0
 public override Token Build(Token lastToken, ScriptEngine engine, Script script, ref SourceCode sourceCode)
 {
     if (sourceCode.Matches("true"))
     {
         sourceCode += 5;
         return new BooleanToken(true);
     }
     else
     {
         sourceCode += 6;
         return new BooleanToken(false);
     }
 }
Ejemplo n.º 4
0
 public override Token Build(Token lastToken, ScriptEngine engine, Script script, ref SourceCode sourceCode)
 {
     if (sourceCode.Matches("//"))
     {
         sourceCode += 2;
         sourceCode.NextLine();
     }
     else
     {
         sourceCode += 2;
         sourceCode.SeekToNext("*/");
         sourceCode += 2;
     }
     return new Token.DelayToken();
 }
 public override Token Build(Token lastToken, ScriptEngine engine, Script script, ref SourceCode sourceCode)
 {
     bool plus = sourceCode.Matches("++");
     sourceCode += 2;
     // Check and see if there is already a chunk to "change".
     if (engine.CurrentTokens.Count != 0)
     {
         var tokens = new List<Token>(engine.CurrentTokens);
         engine.CurrentTokens.Clear();
         return new PlusPlusMinusMinusToken(tokens, plus, false);
     }
     else
     {
         // Register with the builder that we need to be ran at the end of this.
         _typeStack.Push(plus);
         engine.WaitForChunkFinish(this);
         return new Token.DelayToken();
     }
     return null;
 }
Ejemplo n.º 6
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("typeof");
 }
Ejemplo n.º 7
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("+") || sourceCode.Matches("-") || sourceCode.Matches("/") ||
            sourceCode.Matches("*") || sourceCode.Matches("%");
 }
Ejemplo n.º 8
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("true") || sourceCode.Matches("false");
 }
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("==") || sourceCode.Matches("!=") || sourceCode.Matches("<=") ||
            sourceCode.Matches(">=") || sourceCode.Matches(">") || sourceCode.Matches("<");
 }
Ejemplo n.º 10
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches(_pattern);
 }
Ejemplo n.º 11
0
 public override bool ConditionMatch(SourceCode engine)
 {
     return engine.Matches(_identifier);
 }
Ejemplo n.º 12
0
 public override bool ConditionMatch(SourceCode code)
 {
     return code.Matches(_identifier);
 }