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;
 }
 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);
     }
 }
 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;
 }
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("typeof");
 }
Beispiel #7
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches("+") || sourceCode.Matches("-") || sourceCode.Matches("/") ||
            sourceCode.Matches("*") || sourceCode.Matches("%");
 }
 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("<");
 }
Beispiel #10
0
 public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
 {
     return sourceCode.Matches(_pattern);
 }
Beispiel #11
0
 public override bool ConditionMatch(SourceCode engine)
 {
     return engine.Matches(_identifier);
 }
Beispiel #12
0
 public override bool ConditionMatch(SourceCode code)
 {
     return code.Matches(_identifier);
 }