public static Stmt.Member Member(this Parser parser) { Lexer.Token name = parser.Consume("Expected identifier after 'member'", Lexer.Token.TokenType.IDENTIFIER); Expr initialiser = null; if (parser.Match(Lexer.Token.TokenType.EQUAL)) { initialiser = parser.Comparison(); return(new Stmt.Member(name, initialiser)); } Stmt.Comma args = null; if (parser.Match(Lexer.Token.TokenType.WITH)) { args = parser.Comma(); } Stmt.Block block = null; if (parser.Match(Lexer.Token.TokenType.DO)) { block = parser.Block(); } return(new Stmt.Member(name, block, args)); }
public static Stmt Macro(this Parser parser) { parser.Consume("Expected identifier after macro definition", Lexer.Token.TokenType.IDENTIFIER); var id = parser.Previous(); Stmt.Comma args = null; if (parser.Match(Lexer.Token.TokenType.WITH)) { args = parser.Comma(); } parser.Consume("Expected block after macro identifier", Lexer.Token.TokenType.DO); return(new Stmt.Macro(id, parser.Block(), args)); }
public static TrashObject CommaStmt(this Interpreter interpreter, Stmt.Comma stmt) { throw new NotImplementedException(); }
public TrashObject VisitCommaStmt(Stmt.Comma stmt) { return(this.CommaStmt(stmt)); }