本文整理汇总了C#中SourceCode.Matches方法的典型用法代码示例。如果您正苦于以下问题:C# SourceCode.Matches方法的具体用法?C# SourceCode.Matches怎么用?C# SourceCode.Matches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceCode
的用法示例。
在下文中一共展示了SourceCode.Matches方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConditionMatch
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("(");
}
示例2: GetType
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;
}
示例3: Build
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);
}
}
示例4: Build
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();
}
示例5: Build
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;
}
示例6: ConditionMatch
public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
{
return sourceCode.Matches("typeof");
}
示例7: ConditionMatch
public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
{
return sourceCode.Matches("+") || sourceCode.Matches("-") || sourceCode.Matches("/") ||
sourceCode.Matches("*") || sourceCode.Matches("%");
}
示例8: ConditionMatch
public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
{
return sourceCode.Matches("true") || sourceCode.Matches("false");
}
示例9: ConditionMatch
public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
{
return sourceCode.Matches("==") || sourceCode.Matches("!=") || sourceCode.Matches("<=") ||
sourceCode.Matches(">=") || sourceCode.Matches(">") || sourceCode.Matches("<");
}
示例10: ConditionMatch
public override bool ConditionMatch(Token lastToken, SourceCode sourceCode)
{
return sourceCode.Matches(_pattern);
}