From 54c14eb899b2c489c66ad6b52d14d0c2084c04b2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 30 Jan 2011 22:16:59 +0900 Subject: [PATCH] Add "return" to pascal. I'm still not sure I'll keep it, but it's useful for testing. --- tools/qfcc/source/qp-lex.l | 2 ++ tools/qfcc/source/qp-parse.y | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/tools/qfcc/source/qp-lex.l b/tools/qfcc/source/qp-lex.l index 8d951daa0..c01b59351 100644 --- a/tools/qfcc/source/qp-lex.l +++ b/tools/qfcc/source/qp-lex.l @@ -227,6 +227,8 @@ static keyword_t keywords[] = { {"mod", MULOP, 0}, {"and", MULOP, 0}, {"not", NOT, 0}, + + {"return", RETURN, 0}, }; static const char * diff --git a/tools/qfcc/source/qp-parse.y b/tools/qfcc/source/qp-parse.y index 72cbc0f7e..e54160e85 100644 --- a/tools/qfcc/source/qp-parse.y +++ b/tools/qfcc/source/qp-parse.y @@ -126,6 +126,7 @@ int yylex (void); %token PROGRAM VAR ARRAY OF FUNCTION PROCEDURE PBEGIN END IF THEN ELSE %token WHILE DO RANGE ASSIGNOP NOT ELLIPSIS +%token RETURN %type type standard_type %type program_head identifier_list subprogram_head @@ -379,6 +380,10 @@ statement new_label_expr (), new_label_expr ()); } + | RETURN + { + $$ = return_expr (current_func, 0); + } ; variable