Ejemplo n.º 1
0
 public NumberBuilder WithMinusSign()
 {
     _numberRule.Sign = new SignRule {
         Sign = TerminalNodeBuilder.Of(Token.Minus)
     };
     return(this);
 }
Ejemplo n.º 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)
             }
         }
     };
 }
Ejemplo n.º 3
0
 public TermBuilder AsIdentifier(string identifier)
 {
     Build.Identifier = TerminalNodeBuilder.Of(Token.Identifier, identifier);
     return(this);
 }
Ejemplo n.º 4
0
 public NumberBuilder(string number)
 {
     _numberRule = new NumberRule {
         Number = TerminalNodeBuilder.Of(Token.ConstantNumber, number)
     };
 }