예제 #1
0
 public void GetIndentationSize_Spaces3Then6()
 {
     var l = new YamlLexer();
     int actual = l.GetIndentationSize("   ");
     Assert.AreEqual(1, actual);
     actual = l.GetIndentationSize("      ");
     Assert.AreEqual(2, actual);
 }
예제 #2
0
파일: Yaml.cs 프로젝트: tkellogg/enyaml
 internal static object Parse(string content)
 {
     var lexer = new YamlLexer(new ANTLRStringStream(content));
     var tokens = new CommonTokenStream(lexer);
     var parser = new YamlParser(tokens);
     var stream = new CommonTreeNodeStream(parser.value().Tree);
     stream.TokenStream = tokens;
     var tree = new YamlTree(stream);
     return tree.value();
 }
예제 #3
0
 public void GetIndentationSize_BlankString()
 {
     var l = new YamlLexer();
     int actual = l.GetIndentationSize("");
     Assert.AreEqual(0, actual);
 }
예제 #4
0
 private CommonTree GetParser(string content)
 {
     var lexer = new YamlLexer(new ANTLRStringStream(content));
     var tokens = new CommonTokenStream(lexer);
     return (CommonTree)new YamlParser(tokens).value().Tree;
 }