//<stmt-list>// public Node StmtList() { var stmtList = new StmtList(); while (firstOfStatement.Contains(CurrentToken)) { switch (CurrentToken) { case TokenCategory.IDENTIFIER: stmtList.Add(stmtId()); break; case TokenCategory.IF: stmtList.Add(If()); break; case TokenCategory.LOOP: var LooperLupe = new Loop() { AnchorToken = Expect(TokenCategory.LOOP) }; Expect(TokenCategory.CURLY_BRACKET_OPEN); LooperLupe.Add(StmtList()); stmtList.Add(LooperLupe); Expect(TokenCategory.CURLY_BRACKET_CLOSE); break; case TokenCategory.BREAK: stmtList.Add(new Break() { AnchorToken = Expect(TokenCategory.BREAK) }); Expect(TokenCategory.SEMICOLON); break; case TokenCategory.RETURN: var myreturn = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; myreturn.Add(Expression()); stmtList.Add(myreturn); Expect(TokenCategory.SEMICOLON); break; case TokenCategory.SEMICOLON: Expect(TokenCategory.SEMICOLON); break; default: throw new SyntaxError(firstOfStatement, tokenStream.Current); } } return(stmtList); }
/**************************************************************** * Subroutine Node ***************************************************************/ public Node Subroutine() { var subroutToken = Expect(TokenCategory.SUBROUTINE); var subroutName = new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }; Expect(TokenCategory.PARENTHESIS_OPEN); var args = new ArgumentList(); if (CurrentToken != TokenCategory.PARENTHESIS_CLOSE) { args.Add(new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }); while (CurrentToken == TokenCategory.COMMA) { Expect(TokenCategory.COMMA); args.Add(new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }); } } Expect(TokenCategory.PARENTHESIS_CLOSE); var declList = EvaluateDeclarations(); var stmtList = EvaluateStatements(); var ret = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; if (this.labelCache != null) { ret.Add(this.labelCache); this.labelCache = null; } var end = new End() { AnchorToken = Expect(TokenCategory.END) }; var subroutResult = new Subroutine() { subroutName, args, declList, stmtList, ret, end }; subroutResult.AnchorToken = subroutToken; return(subroutResult); }
public Node StmtReturn() { var statementReturn = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; statementReturn.Add(Expr()); Expect(TokenCategory.SEMICOLON); return(statementReturn); }
public Node Return() { var node = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; node.Add(Expr()); Expect(TokenCategory.SEMICOLON); return(node); }
public Node Return() { var n1 = new Return() { AnchorToken = Expect(TokenType.RETURN) }; n1.Add(Expression()); Expect(TokenType.INSTRUCTION_END); return(n1); }
public Node StmtReturn() { var returnStatement = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; returnStatement.Add(Expr()); Expect(TokenCategory.SEMICOLON); return(returnStatement); }
public Node StatementReturn() { var n1 = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; var result = Expression(); n1.Add(result); Expect(TokenCategory.SEMICOL); return(n1); }
public Node Return() { var result = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; if (firstOfSimpleExpression.Contains(CurrentToken)) { result.Add(Expression()); } Expect(TokenCategory.SEMICOL); return(result); }
public Node Return() { var result = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; if (CurrentToken != TokenCategory.SEMICOLON) { result.Add(Expression()); } Expect(TokenCategory.SEMICOLON); return(result); }
public override void SetReturnValue(GDBMIParser.GDBMIResponse resp) { foreach (GDBMIParser.GDBMIStreamRecord sr in resp.stream) { if (sr.type != GDBMIParser.GDBMIStreamRecord.GDBMIStreamRecordType.console) { continue; } Match match = regexDecl.Match(sr.str); if (match.Success) { ThreadInfo ti = new ThreadInfo(); ti.raw = match.Groups[0].Value; ti.pid = match.Groups[1].Value; ti.tid = match.Groups[2].Value; Return.Add(ti); } } }
/**************************************************************** * Function Node ***************************************************************/ public Node Function() { var funcType = new FunctionType() { AnchorToken = Type() }; var funcToken = Expect(TokenCategory.FUNCTION); var funcId = new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }; var args = new ArgumentList(); Expect(TokenCategory.PARENTHESIS_OPEN); if (CurrentToken != TokenCategory.PARENTHESIS_CLOSE) { args.Add(new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }); while (CurrentToken == TokenCategory.COMMA) { Expect(TokenCategory.COMMA); args.Add(new Identifier() { AnchorToken = Expect(TokenCategory.IDENTIFIER) }); } } Expect(TokenCategory.PARENTHESIS_CLOSE); var declList = EvaluateDeclarations(); var stmtList = EvaluateStatements(); var ret = new Return() { AnchorToken = Expect(TokenCategory.RETURN) }; if (this.labelCache != null) { ret.Add(this.labelCache); this.labelCache = null; } var end = new End() { AnchorToken = Expect(TokenCategory.END) }; var funcResult = new Function() { funcType, funcId, args, declList, stmtList, ret, end }; funcResult.AnchorToken = funcToken; return(funcResult); }