Add "return" to pascal.

I'm still not sure I'll keep it, but it's useful for testing.
This commit is contained in:
Bill Currie 2011-01-30 22:16:59 +09:00
parent e7424e1496
commit 54c14eb899
2 changed files with 7 additions and 0 deletions

View file

@ -227,6 +227,8 @@ static keyword_t keywords[] = {
{"mod", MULOP, 0}, {"mod", MULOP, 0},
{"and", MULOP, 0}, {"and", MULOP, 0},
{"not", NOT, 0}, {"not", NOT, 0},
{"return", RETURN, 0},
}; };
static const char * static const char *

View file

@ -126,6 +126,7 @@ int yylex (void);
%token PROGRAM VAR ARRAY OF FUNCTION PROCEDURE PBEGIN END IF THEN ELSE %token PROGRAM VAR ARRAY OF FUNCTION PROCEDURE PBEGIN END IF THEN ELSE
%token WHILE DO RANGE ASSIGNOP NOT ELLIPSIS %token WHILE DO RANGE ASSIGNOP NOT ELLIPSIS
%token RETURN
%type <type> type standard_type %type <type> type standard_type
%type <symbol> program_head identifier_list subprogram_head %type <symbol> program_head identifier_list subprogram_head
@ -379,6 +380,10 @@ statement
new_label_expr (), new_label_expr (),
new_label_expr ()); new_label_expr ());
} }
| RETURN
{
$$ = return_expr (current_func, 0);
}
; ;
variable variable