Beispiel #1
0
        public void SectionRefWithParameters()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"class A {
    @+ Fields(fields)
}
@section Fields(f: string[])
@code
    foreach (var field in f)
    {
        @text
        private string @(field);
        @end_text
    }
@end_code

@end_section");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst    ast        = parserIntruder.ReadField <AtTemplateAst>("ast");
            SectionReference sectionRef = (SectionReference)ast.Body.Directives[1];

            Assert.That(sectionRef.Name, Is.EqualTo("Fields"));
            Assert.That(sectionRef.Rest, Is.EqualTo("(fields)"));
        }
Beispiel #2
0
        public void TwoSectionDefinition()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"line1
@section sec
line2
@end_section
@section sec2
line3
line4
@end_section
");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst     ast      = parserIntruder.ReadField <AtTemplateAst>("ast");
            SectionDefinition section1 = (SectionDefinition)ast.Body.Directives[1];
            SectionDefinition section2 = (SectionDefinition)ast.Body.Directives[2];

            Assert.That(section1.Name, Is.EqualTo("sec"));
            Assert.That(section1.Directives.Count, Is.EqualTo(1));

            Assert.That(section2.Name, Is.EqualTo("sec2"));
            Assert.That(section2.Directives.Count, Is.EqualTo(2));
        }
Beispiel #3
0
        public void Head()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"@# comment
@reference System.Windows.Forms.dll
@import System.Windows.Forms
@param name: string
@
@global
string firstName;
string lastName;
@end_global");
            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(ast.Head.References.Count, Is.EqualTo(3));
            Assert.That(ast.Head.Imports.Count, Is.EqualTo(1));
            Assert.That(ast.Head.Parameters.Count, Is.EqualTo(1));
            Assert.That(ast.Head.Global.Length, Is.GreaterThan(0));
        }
Beispiel #4
0
        public void Indentation()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"{
            @code
            int i = 0;
            @text
            123
            @end_text
            @end_code
            }");
            parser.Debug = true;

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            SourceGenerator generator = new SourceGenerator();
            generator.Ast = parserIntruder.ReadField<AtTemplateAst>("ast");
            generator.Debugging = true;
            generator.Walk();

            Console.WriteLine(generator.SourceCode);
        }
Beispiel #5
0
        public void Indentation()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"{
    @code
        int i = 0;
        @text
        123
        @end_text
    @end_code
}");
            parser.Debug = true;

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            SourceGenerator generator = new SourceGenerator();

            generator.Ast       = parserIntruder.ReadField <AtTemplateAst>("ast");
            generator.Debugging = true;
            generator.Walk();

            Console.WriteLine(generator.SourceCode);
        }
Beispiel #6
0
        public void BadSectionDefinition(string code)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(code);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");
        }
Beispiel #7
0
        public void BadSectionDefinition(string code)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(code);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");
        }
Beispiel #8
0
        public void Between(string text)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(ast.Body.Directives[1] is Between);
        }
Beispiel #9
0
        public void BadSectionRef()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"class A {
            @+ 12Fields
            }
            @section Fields
            line1
            @end_section");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");
        }
Beispiel #10
0
        public void Between(string text)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(ast.Body.Directives[1] is Between);
        }
Beispiel #11
0
        public void StaticTexts(string text, string expected)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(((StaticText)ast.Body.Directives[0]).Value, Is.EqualTo(expected));
        }
Beispiel #12
0
        public void Execution()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader("@! int a = 1;");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(((Execution)ast.Body.Directives[0]).Statement, Is.EqualTo(" int a = 1;"));
        }
Beispiel #13
0
        public void Evaluations(string text, string expected)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(((Evaluation)ast.Body.Directives[1]).Expression, Is.EqualTo(expected));
        }
Beispiel #14
0
        public void Code(string text, string expected)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(
                ((DynamicText) ((Code) ast.Body.Directives[0]).Directives[0]).Value,
                Is.EqualTo(expected));
        }
Beispiel #15
0
        public void Text(string text)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(
                ((Code)ast.Body.Directives[0]).Directives[0] is Cavingdeep.Dcg.At.Parsing.Text);
        }
Beispiel #16
0
        public void BadSectionRef()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"class A {
    @+ 12Fields
}
@section Fields
line1
@end_section");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");
        }
Beispiel #17
0
        public void WithParameters(string code, int paramCount)
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(code);

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst     ast     = parserIntruder.ReadField <AtTemplateAst>("ast");
            SectionDefinition section = (SectionDefinition)ast.Body.Directives[0];

            Assert.That(section.Name, Is.EqualTo("Foo"));
            Assert.That(section.Parameters.Count, Is.EqualTo(paramCount));
        }
Beispiel #18
0
        public void Output()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(@"@output key
123
@end_output");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(((Output)ast.Body.Directives[0]).WriterKey, Is.EqualTo("key"));
        }
Beispiel #19
0
        public void NonTopLevelSectionDefinition()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"@code
    @text
    @section sec
    line2
    @end_section
    @end_text
@end_code");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");
        }
Beispiel #20
0
        public void TwoSectionDefinition_WithSameName()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"line1
@section sec
line2
@end_section
@section sec
line3
@end_section
");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");
        }
Beispiel #21
0
        public void MultiEvaluation()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(@"@global
    string Foo() { return ""1" + "\r\n" + @"2""; }
@end_global
    @= Foo()");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(((MultiLineEvaluation)ast.Body.Directives[0]).Expression, Is.EqualTo(" Foo()"));
            Assert.That(((MultiLineEvaluation)ast.Body.Directives[0]).Spaces, Is.EqualTo("    "));
        }
Beispiel #22
0
        public void InnerDirectives()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(@"@# comment
@code
    @text
        @code
        @end_code
    @end_text
@end_code");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(
                ((Cavingdeep.Dcg.At.Parsing.Text)((Code)ast.Body.Directives[0]).Directives[0]).Directives[0] is Code);
        }
Beispiel #23
0
        public void SectionRefWithNoParameters()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"class A {
    @+ Fields  
}
@section Fields
line1
@end_section");

            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst    ast        = parserIntruder.ReadField <AtTemplateAst>("ast");
            SectionReference sectionRef = (SectionReference)ast.Body.Directives[1];

            Assert.That(sectionRef.Name, Is.EqualTo("Fields"));
        }
Beispiel #24
0
        public void First()
        {
            AtParser parser = new AtParser();

            parser.Reader = new StringReader(
                @"@# comment
@param name: string
@param age: int
@
Hello @(name), @{
    if (age >= 18)
    {
        @text
        you are adult.
        @end_text
    }
@}");
            Intruder parserIntruder = new Intruder(parser);

            parserIntruder.CallMethod <object>("InitParsing");
            parserIntruder.CallMethod <object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField <AtTemplateAst>("ast");

            Assert.That(ast.Head.Parameters.Count, Is.EqualTo(2));
            Assert.That(ast.Head.Parameters[0].Name, Is.EqualTo("name"));
            Assert.That(ast.Head.Parameters[0].Type, Is.EqualTo("string"));
            Assert.That(ast.Head.Parameters[1].Name, Is.EqualTo("age"));
            Assert.That(ast.Head.Parameters[1].Type, Is.EqualTo("int"));

            Assert.That(((StaticText)ast.Body.Directives[0]).Value, Is.EqualTo("Hello "));
            Assert.That(((Evaluation)ast.Body.Directives[1]).Expression, Is.EqualTo("name"));
            Assert.That(((StaticText)ast.Body.Directives[2]).Value, Is.EqualTo(", "));
            Assert.That(((DynamicText)((Between)ast.Body.Directives[3]).Directives[0]).Value, Is.EqualTo("    if (age >= 18)"));
            Assert.That(((DynamicText)((Between)ast.Body.Directives[3]).Directives[1]).Value, Is.EqualTo("    {"));
            Assert.That(((StaticText)((Cavingdeep.Dcg.At.Parsing.Text)((Between)ast.Body.Directives[3]).Directives[2]).Directives[0]).Value, Is.EqualTo("you are adult.\r\n"));
            Assert.That(((DynamicText)((Between)ast.Body.Directives[3]).Directives[3]).Value, Is.EqualTo("    }"));
            Assert.That(((StaticText)ast.Body.Directives[4]).Value, Is.EqualTo("\r\n"));
        }
Beispiel #25
0
        public void First()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
                @"@# comment
            @param name: string
            @param age: int
            @
            Hello @(name), @{
            if (age >= 18)
            {
            @text
            you are adult.
            @end_text
            }
            @}");
            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(ast.Head.Parameters.Count, Is.EqualTo(2));
            Assert.That(ast.Head.Parameters[0].Name, Is.EqualTo("name"));
            Assert.That(ast.Head.Parameters[0].Type, Is.EqualTo("string"));
            Assert.That(ast.Head.Parameters[1].Name, Is.EqualTo("age"));
            Assert.That(ast.Head.Parameters[1].Type, Is.EqualTo("int"));

            Assert.That(((StaticText) ast.Body.Directives[0]).Value, Is.EqualTo("Hello "));
            Assert.That(((Evaluation) ast.Body.Directives[1]).Expression, Is.EqualTo("name"));
            Assert.That(((StaticText) ast.Body.Directives[2]).Value, Is.EqualTo(", "));
            Assert.That(((DynamicText) ((Between) ast.Body.Directives[3]).Directives[0]).Value, Is.EqualTo("    if (age >= 18)"));
            Assert.That(((DynamicText) ((Between) ast.Body.Directives[3]).Directives[1]).Value, Is.EqualTo("    {"));
            Assert.That(((StaticText) ((Cavingdeep.Dcg.At.Parsing.Text) ((Between) ast.Body.Directives[3]).Directives[2]).Directives[0]).Value, Is.EqualTo("you are adult.\r\n"));
            Assert.That(((DynamicText) ((Between) ast.Body.Directives[3]).Directives[3]).Value, Is.EqualTo("    }"));
            Assert.That(((StaticText) ast.Body.Directives[4]).Value, Is.EqualTo("\r\n"));
        }
Beispiel #26
0
        public void BasicSectionDefinition()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"line1
            @section sec
            line2
            @end_section
            ");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");
            SectionDefinition section = (SectionDefinition) ast.Body.Directives[1];

            Assert.That(section.Name, Is.EqualTo("sec"));
            Assert.That(section.Directives.Count, Is.EqualTo(1));
        }
Beispiel #27
0
        public void Evaluations(string text, string expected)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(((Evaluation) ast.Body.Directives[1]).Expression, Is.EqualTo(expected));
        }
Beispiel #28
0
        public void Text(string text)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(text);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(
                ((Code) ast.Body.Directives[0]).Directives[0] is Cavingdeep.Dcg.At.Parsing.Text);
        }
Beispiel #29
0
        public void SectionRefWithNoParameters()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"class A {
            @+ Fields
            }
            @section Fields
            line1
            @end_section");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");
            SectionReference sectionRef = (SectionReference) ast.Body.Directives[1];

            Assert.That(sectionRef.Name, Is.EqualTo("Fields"));
        }
Beispiel #30
0
        public void MultiEvaluation()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(@"@global
            string Foo() { return ""1" + "\r\n" + @"2""; }
            @end_global
            @= Foo()");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(((MultiLineEvaluation) ast.Body.Directives[0]).Expression, Is.EqualTo(" Foo()"));
            Assert.That(((MultiLineEvaluation) ast.Body.Directives[0]).Spaces, Is.EqualTo("    "));
        }
Beispiel #31
0
        public void Output()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(@"@output key
            123
            @end_output");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(((Output) ast.Body.Directives[0]).WriterKey, Is.EqualTo("key"));
        }
Beispiel #32
0
        public void Head()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
                @"@# comment
            @reference System.Windows.Forms.dll
            @import System.Windows.Forms
            @param name: string
            @
            @global
            string firstName;
            string lastName;
            @end_global");
            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(ast.Head.References.Count, Is.EqualTo(3));
            Assert.That(ast.Head.Imports.Count, Is.EqualTo(1));
            Assert.That(ast.Head.Parameters.Count, Is.EqualTo(1));
            Assert.That(ast.Head.Global.Length, Is.GreaterThan(0));
        }
Beispiel #33
0
        public void InnerDirectives()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(@"@# comment
            @code
            @text
            @code
            @end_code
            @end_text
            @end_code");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(
                ((Cavingdeep.Dcg.At.Parsing.Text) ((Code) ast.Body.Directives[0]).Directives[0]).Directives[0] is Code);
        }
Beispiel #34
0
        public void Execution()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader("@! int a = 1;");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");

            Assert.That(((Execution) ast.Body.Directives[0]).Statement, Is.EqualTo(" int a = 1;"));
        }
Beispiel #35
0
        public void WithParameters(string code, int paramCount)
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(code);

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");
            SectionDefinition section = (SectionDefinition) ast.Body.Directives[0];

            Assert.That(section.Name, Is.EqualTo("Foo"));
            Assert.That(section.Parameters.Count, Is.EqualTo(paramCount));
        }
Beispiel #36
0
        public void TwoSectionDefinition_WithSameName()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"line1
            @section sec
            line2
            @end_section
            @section sec
            line3
            @end_section
            ");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");
        }
Beispiel #37
0
        public void SectionRefWithParameters()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"class A {
            @+ Fields(fields)
            }
            @section Fields(f: string[])
            @code
            foreach (var field in f)
            {
            @text
            private string @(field);
            @end_text
            }
            @end_code

            @end_section");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");

            AtTemplateAst ast = parserIntruder.ReadField<AtTemplateAst>("ast");
            SectionReference sectionRef = (SectionReference) ast.Body.Directives[1];

            Assert.That(sectionRef.Name, Is.EqualTo("Fields"));
            Assert.That(sectionRef.Rest, Is.EqualTo("(fields)"));
        }
Beispiel #38
0
        public void NonTopLevelSectionDefinition()
        {
            AtParser parser = new AtParser();
            parser.Reader = new StringReader(
            @"@code
            @text
            @section sec
            line2
            @end_section
            @end_text
            @end_code");

            Intruder parserIntruder = new Intruder(parser);
            parserIntruder.CallMethod<object>("InitParsing");
            parserIntruder.CallMethod<object>("BuildAst");
        }