public Node Proc() { var result = new ProcDeclaration() { AnchorToken = Expect(TokenCategory.PROC) }; result.Add(new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }); Expect(TokenCategory.PARENTHESIS_OPEN); var param = new ProcParam(); while (CurrentToken == TokenCategory.IDENTIFIER) { param.Add(ParamDeclaration()); } Expect(TokenCategory.PARENTHESIS_CLOSE); result.Add(param); var type = new ProcType(); if (CurrentToken == TokenCategory.TWOPOINTS) { Expect(TokenCategory.TWOPOINTS); type.Add(ChimeraType()); } result.Add(type); var con = new ProcConst(); Expect(TokenCategory.SEMICOL); if (CurrentToken == TokenCategory.CONST) { con.Add(Const()); } result.Add(con); var va = new ProcVar(); if (CurrentToken == TokenCategory.VAR) { va.Add(Var()); } result.Add(va); var procStatement = new ProcStatement() { AnchorToken = Expect(TokenCategory.BEGIN) }; while (firstOfStatement.Contains(CurrentToken)) { procStatement.Add(Statement()); } Expect(TokenCategory.END); Expect(TokenCategory.SEMICOL); result.Add(procStatement); return(result); }
public Type Visit(ProcVar node) { VisitChildren(node); return(Type.VOID); }
public string Visit(ProcVar node) { return(VisitChildren(node)); }