예제 #1
0
 public NumberBuilder WithMinusSign()
 {
     _numberRule.Sign = new SignRule {
         Sign = TerminalNodeBuilder.Of(Token.Minus)
     };
     return(this);
 }
예제 #2
0
 public MainFunctionBuilder()
 {
     _mainFunctionRule = new MainFunctionRule
     {
         DataType         = TerminalNodeBuilder.Of(Token.Int),
         Main             = TerminalNodeBuilder.Of(Token.Main),
         LeftParenthesis  = TerminalNodeBuilder.Of(Token.ParenthesisLeft),
         RightParenthesis = TerminalNodeBuilder.Of(Token.ParenthesisRight),
         FunctionBody     = new FunctionBodyRule
         {
             LeftCurlyBracket  = TerminalNodeBuilder.Of(Token.CurlyBracketLeft),
             RightCurlyBracket = TerminalNodeBuilder.Of(Token.CurlyBracketRight),
             ReturnStatement   = new ReturnStatementRule
             {
                 Return     = TerminalNodeBuilder.Of(Token.Return),
                 Expression = new ExpressionRule
                 {
                     Term = new TermRule
                     {
                         Number = new NumberRule
                         {
                             Number = TerminalNodeBuilder.Of(Token.ConstantNumber, "0")
                         }
                     }
                 },
                 Semicolon = TerminalNodeBuilder.Of(Token.Semicolon)
             }
         }
     };
 }
예제 #3
0
 public TermBuilder AsIdentifier(string identifier)
 {
     Build.Identifier = TerminalNodeBuilder.Of(Token.Identifier, identifier);
     return(this);
 }
예제 #4
0
 public NumberBuilder(string number)
 {
     _numberRule = new NumberRule {
         Number = TerminalNodeBuilder.Of(Token.ConstantNumber, number)
     };
 }