本文整理汇总了C#中Lexer.Lexer.ParseExtend方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.ParseExtend方法的具体用法?C# Lexer.ParseExtend怎么用?C# Lexer.ParseExtend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.ParseExtend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseExtend_NOK05
public void ParseExtend_NOK05()
{
const string text = " extend Foo {";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseExtend());
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(3, lex.Index);
}
示例2: ParseExtend_NOK04
public void ParseExtend_NOK04()
{
const string text = " extend Foo x\r\n optional int32 bar = 126;\r\n }";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseExtend());
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(2, lex.Index);
}
示例3: ParseExtend_OK02
public void ParseExtend_OK02()
{
const string Text = "extend Package1.Foo { \r\n optional string bar = 100;\r\n }";
var lex = new Lexer(Text) { Matches = Helper.SplitText(Text) };
Assert.IsTrue(lex.ParseExtend());
Assert.AreEqual(7, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(14, lex.Index);
Assert.AreEqual(0, lex.Tokens[0].Position);
Assert.AreEqual(7, lex.Tokens[1].Position);
Assert.AreEqual(16, lex.Tokens[2].Position);
Assert.AreEqual(28, lex.Tokens[3].Position);
Assert.AreEqual(37, lex.Tokens[4].Position);
Assert.AreEqual(44, lex.Tokens[5].Position);
Assert.AreEqual(50, lex.Tokens[6].Position);
Assert.AreEqual(6, lex.Tokens[0].Length);
Assert.AreEqual(8, lex.Tokens[1].Length);
Assert.AreEqual(3, lex.Tokens[2].Length);
Assert.AreEqual(8, lex.Tokens[3].Length);
Assert.AreEqual(6, lex.Tokens[4].Length);
Assert.AreEqual(3, lex.Tokens[5].Length);
Assert.AreEqual(3, lex.Tokens[6].Length);
Assert.AreEqual(CodeType.TopLevelCmd, lex.Tokens[0].CodeType);
Assert.AreEqual(CodeType.SymRef, lex.Tokens[1].CodeType);
Assert.AreEqual(CodeType.SymRef, lex.Tokens[2].CodeType);
Assert.AreEqual(CodeType.FieldRule, lex.Tokens[3].CodeType);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[4].CodeType);
Assert.AreEqual(CodeType.SymDef, lex.Tokens[5].CodeType);
Assert.AreEqual(CodeType.Number, lex.Tokens[6].CodeType);
}
示例4: ParseExtend_OK01
public void ParseExtend_OK01()
{
const string Text = " extend Foo {\r\n optional int32 bar = 126;\r\n }";
var lex = new Lexer(Text) { Matches = Helper.SplitText(Text) };
Assert.IsTrue(lex.ParseExtend());
Assert.AreEqual(6, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(12, lex.Index);
Assert.AreEqual(2, lex.Tokens[0].Position);
Assert.AreEqual(9, lex.Tokens[1].Position);
Assert.AreEqual(17, lex.Tokens[2].Position);
Assert.AreEqual(26, lex.Tokens[3].Position);
Assert.AreEqual(32, lex.Tokens[4].Position);
Assert.AreEqual(38, lex.Tokens[5].Position);
Assert.AreEqual(6, lex.Tokens[0].Length);
Assert.AreEqual(3, lex.Tokens[1].Length);
Assert.AreEqual(8, lex.Tokens[2].Length);
Assert.AreEqual(5, lex.Tokens[3].Length);
Assert.AreEqual(3, lex.Tokens[4].Length);
Assert.AreEqual(3, lex.Tokens[5].Length);
Assert.AreEqual(CodeType.TopLevelCmd, lex.Tokens[0].CodeType);
Assert.AreEqual(CodeType.SymRef, lex.Tokens[1].CodeType);
Assert.AreEqual(CodeType.FieldRule, lex.Tokens[2].CodeType);
Assert.AreEqual(CodeType.Keyword, lex.Tokens[3].CodeType);
Assert.AreEqual(CodeType.SymDef, lex.Tokens[4].CodeType);
Assert.AreEqual(CodeType.Number, lex.Tokens[5].CodeType);
}