Beispiel #1
0
 public void Register(IGrammarBuilder <INode> grammar)
 {
     grammar.Sequence("minmax",
                      grammar.TerminalValue("{"),
                      grammar.Terminal(TokenType.Number).As("min"),
                      grammar.Optional(null, grammar.TerminalValue(",")).As("sep"),
                      grammar.Optional(null, grammar.Terminal(TokenType.Number)).As("max"),
                      grammar.TerminalValue("}")
                      ).ReduceWith(Reduce);
 }
 public void Register(IGrammarBuilder <INode> grammar)
 {
     grammar.Sequence("atomExpression",
                      grammar.Optional(null,
                                       grammar.Choice(null,
                                                      grammar.TerminalValue("&"),
                                                      grammar.TerminalValue("!")
                                                      )
                                       ).As("prefix"),
                      grammar.Ref("atom"),
                      grammar.Optional(null, grammar.Ref("range")).As("suffix")
                      ).ReduceWith(Reduce);
 }
Beispiel #3
0
 public void Register(IGrammarBuilder <INode> grammar)
 {
     grammar.Sequence("namedAtom",
                      grammar.Ref("atomExpression").As("atom"),
                      grammar.Optional(null,
                                       grammar.Choice(null,
                                                      grammar.TerminalValue("#!"),
                                                      grammar.Sequence(null,
                                                                       grammar.TerminalValue("#"),
                                                                       grammar.Terminal(TokenType.Identifier)
                                                                       ))
                                       ).As("name")
                      ).ReduceWith(Reduce);
 }