本文整理汇总了C#中Lexer.Lexer.ParseFieldOption方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.ParseFieldOption方法的具体用法?C# Lexer.ParseFieldOption怎么用?C# Lexer.ParseFieldOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.ParseFieldOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseFiledOption_NOK04
public void ParseFiledOption_NOK04()
{
const string text = " cpp=\r\n"; // incomplete statement
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseFieldOption());
Assert.AreEqual(1, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(3, lex.Index);
}
示例2: ParseFiledOption_NOK02
public void ParseFiledOption_NOK02()
{
const string text = " aaa"; // incomplete statement
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseFieldOption());
Assert.AreEqual(1, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(1, lex.Index);
Assert.AreEqual(2, lex.Tokens[0].Position);
Assert.AreEqual(3, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
}
示例3: ParseFiledOption_OK05
public void ParseFiledOption_OK05()
{
const string text = " (aaa)=abcdefgh];";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsTrue(lex.ParseFieldOption());
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(4, lex.Index);
Assert.AreEqual(3, lex.Tokens[0].Position);
Assert.AreEqual(3, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
Assert.AreEqual(8, lex.Tokens[1].Position);
Assert.AreEqual(8, lex.Tokens[1].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[1].CodeType);
}
示例4: ParseFiledOption_NOK06
public void ParseFiledOption_NOK06()
{
const string text = " (aaa=abcdefgh];"; // closing bracket is missing
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseFieldOption());
Assert.AreEqual(1, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(2, lex.Index);
Assert.AreEqual(3, lex.Tokens[0].Position);
Assert.AreEqual(3, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
}