本文整理汇总了C#中Lexer.Lexer.ParseDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.ParseDefault方法的具体用法?C# Lexer.ParseDefault怎么用?C# Lexer.ParseDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.ParseDefault方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Default_NOK03
public void Default_NOK03()
{
const string text = "default=-1234a]";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
var field = new Field { FieldType = FieldType.TypeString, HasOption = false };
Assert.IsFalse(lex.ParseDefault(field));
Assert.AreEqual(1, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(0, lex.Tokens[0].Position);
Assert.AreEqual(7, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
Assert.AreEqual(8, lex.Errors[0].Position);
Assert.AreEqual(6, lex.Errors[0].Length);
Assert.AreEqual(CodeType.Text, lex.Errors[0].CodeType);
}
示例2: Default_NOK02
public void Default_NOK02()
{
const string text = "default=\"-1234a\"]";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
var field = new Field { FieldType = FieldType.TypeInt32, HasOption = false };
Assert.IsTrue(lex.ParseDefault(field));
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(0, lex.Tokens[0].Position);
Assert.AreEqual(7, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
Assert.AreEqual(0, lex.Line);
Assert.AreEqual(8, lex.Tokens[1].Position);
Assert.AreEqual(1, lex.Tokens[1].Length);
Assert.AreEqual(CodeType.Number, lex.Tokens[1].CodeType);
Assert.AreEqual(0, lex.Line);
}
示例3: Default_OK03
public void Default_OK03()
{
const string text = "default=ABCDE]";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
var field = new Field { FieldType = FieldType.TypeUnknown, HasOption = false };
Assert.IsTrue(lex.ParseDefault(field));
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(0, lex.Tokens[0].Position);
Assert.AreEqual(7, lex.Tokens[0].Length);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[0].CodeType);
Assert.AreEqual(8, lex.Tokens[1].Position);
Assert.AreEqual(5, lex.Tokens[1].Length);
Assert.AreEqual(CodeType.Enums, lex.Tokens[1].CodeType);
}