本文整理汇总了C#中Lexer.Lexer.ParseMessageField方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.ParseMessageField方法的具体用法?C# Lexer.ParseMessageField怎么用?C# Lexer.ParseMessageField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.ParseMessageField方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageField_NOK05
public void MessageField_NOK05()
{
const string text = " option"; // statement not finished
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(0, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(1, lex.Index);
}
示例2: MessageField_NOK02
public void MessageField_NOK02()
{
const string text = " optional string test1 ;"; // = + number is missing
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(3, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(3, lex.Index);
}
示例3: MessageField_NOK06
public void MessageField_NOK06()
{
const string text = " optional test1 = ;"; // statement incomplete
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(2, lex.Index);
}
示例4: MessageField_OK06
public void MessageField_OK06()
{
const string text = " msg1.msg2.msg3 test1 = 1;\r\naaa";
var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };
Assert.IsTrue(lex.ParseMessageField());
Assert.AreEqual(5, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(10, lex.Index);
}
示例5: MessageField_OK03
public void MessageField_OK03()
{
const string text = " optional string test1 = 1;\r\naaa";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsTrue(lex.ParseMessageField());
Assert.AreEqual(4, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(7, lex.Index);
}
示例6: MessageField_OK02
public void MessageField_OK02()
{
const string text = " optional string test1 = 1 [default=\"Farz\"];";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsTrue(lex.ParseMessageField());
Assert.AreEqual(6, lex.Tokens.Count);
Assert.AreEqual(0, lex.Errors.Count);
Assert.AreEqual(13, lex.Index);
}
示例7: MessageField_NOK21
public void MessageField_NOK21()
{
const string text = " .\r\n";
var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(0, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(2, lex.Index);
}
示例8: MessageField_NOK16
public void MessageField_NOK16()
{
const string text = " optional msg1.msg2.msg3 test1 = 1";
var lex = new Lexer(text) { Matches = Helper.SplitText(text), Proto3 = true };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(0, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(1, lex.Index);
}
示例9: MessageField_NOK15
public void MessageField_NOK15()
{
const string text = " optional string";
var lex = new Lexer(text) { Matches = Helper.SplitText(text) };
Assert.IsFalse(lex.ParseMessageField());
Assert.AreEqual(2, lex.Tokens.Count);
Assert.AreEqual(1, lex.Errors.Count);
Assert.AreEqual(2, lex.Index);
}