Example #1
0
 public void NonTerminalKeyPairAndFlag()
 {
     Checker.CheckRule(
         "S -> T<cond1=value1;cond2>",
         new[]
     {
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.NonTerminal, "T", conditions: new []
             {
                 new Condition("cond1", "value1"),
                 new Condition("cond2", false)
             })
         })
     }
         );
 }
Example #2
0
 public void NonTerminalKeyPairAndList()
 {
     Checker.CheckRule(
         "S -> T<cond1=value1;cond2=val1,val2>",
         new[]
     {
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.NonTerminal, "T", conditions: new []
             {
                 new Condition("cond1", "value1"),
                 new Condition("cond2", new [] { "val1", "val2" })
             })
         })
     }
         );
 }
Example #3
0
 public void NonTerminalTwoKeyPair()
 {
     Checker.CheckRule(
         "S -> T<cond1=value1;cond2=value2>",
         new[]
     {
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.NonTerminal, "T", conditions: new []
             {
                 new Condition("cond1", "value1"),
                 new Condition("cond2", "value2")
             })
         })
     }
         );
 }
Example #4
0
 public void NonTerminalAllTypes()
 {
     Checker.CheckRule(
         "S -> T<cond1=value1;cond2=val1,val2;cond3>",
         new[]
     {
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.NonTerminal, "T", conditions: new []
             {
                 new Condition("cond1", "value1"),
                 new Condition("cond2", new [] { "val1", "val2" }),
                 new Condition("cond3", false)
             })
         })
     }
         );
 }
Example #5
0
 public void TerminalAndInlineRuleWithHead()
 {
     Checker.CheckRule(
         "S -> \"хер\" !(\"123\")",
         new[]
     {
         new Rule("S:1",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "123")
         }),
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "хер"),
             new RuleItem(RuleItemType.NonTerminal, "S:1", isHead: true),
         })
     }
         );
 }
Example #6
0
 public void TerminalAndInlineRuleWithCounter()
 {
     Checker.CheckRule(
         "S -> \"хер\" (\"123\")+",
         new[]
     {
         new Rule("S:1",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "123")
         }),
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "хер"),
             new RuleItem(RuleItemType.NonTerminal, "S:1", Counter.Plus),
         })
     }
         );
 }
Example #7
0
        public void MultipleRules()
        {
            Checker.CheckRule(
                "S -> T*<cond1=value1;cond2=value2> \"123\" | G+<morf=123>",
                new[]
            {
                new Rule("S",
                         new[]
                {
                    new RuleItem(RuleItemType.NonTerminal,
                                 "T",
                                 conditions: new []
                    {
                        new Condition("cond1", "value1"),
                        new Condition("cond2", "value2")
//
                    },
                                 counter: Counter.Star
                                 ),
                    new RuleItem(
                        RuleItemType.Terminal,
                        "123"
                        )
                }
                         ),
                new Rule("S",
                         new[]
                {
                    new RuleItem(RuleItemType.NonTerminal,
                                 "G",
                                 conditions: new []
                    {
                        new Condition("morf", "123")
                    },
                                 counter: Counter.Plus
                                 )
                }
                         )
            }
                );
        }
Example #8
0
 public void TerminalAndInlineRuleWithCondition()
 {
     Checker.CheckRule(
         "S -> \"хер\" (\"123\")<условие>",
         new[]
     {
         new Rule("S:1",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "123")
         }),
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.Terminal, "хер"),
             new RuleItem(RuleItemType.NonTerminal, "S:1", conditions: new []
             {
                 new Condition("условие", false)
             }),
         })
     }
         );
 }
Example #9
0
 public void NonTerminalWithCounterAndConditions()
 {
     Checker.CheckRule(
         "S -> T*<cond1=value1;cond2=value2;cond3=123>",
         new[]
     {
         new Rule("S",
                  new[]
         {
             new RuleItem(RuleItemType.NonTerminal,
                          "T",
                          conditions: new []
             {
                 new Condition("cond1", "value1"),
                 new Condition("cond2", "value2"),
                 new Condition("cond3", "123"),
             },
                          counter: Counter.Star
                          )
         }
                  )
     }
         );
 }
Example #10
0
 public void MultipleRulesWithAll()
 {
     Checker.CheckRule(
         "S[Val1=123123, Val1=$tt.Val] -> T*<cond=val;cond1=valr> as tt",
         new[]
Example #11
0
 public void OneTerminalWithLocalName()
 {
     Checker.CheckRule(
         "S -> \"123\" as numb1",
         new[]
Example #12
0
 public void StaticVarInt()
 {
     Checker.CheckRule(
         "S[Value=$val] -> T l\"хер\" #set val=123",
         new[]
Example #13
0
 public void NonTerminalTwoKeyPairAndLocalName()
 {
     Checker.CheckRule(
         "S -> T<cond1=value1;cond2=value2> as name",
         new[]
Example #14
0
 public void TerminalAndInlineRuleWithLocalName()
 {
     Checker.CheckRule(
         "S -> \"хер\" (\"123\") as test",
         new[]