diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-08-17 20:02:44 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-08-17 20:02:44 +0200 |
commit | fb582b6ff0ba7b5a675c9fa95b8921769873352e (patch) | |
tree | d05aa819890e3987325f8ec978b40d135a568ae2 | |
parent | fdaf9ebf7daa1c98d420ff8eff4633e8ed277b13 (diff) | |
download | compilertests-fb582b6ff0ba7b5a675c9fa95b8921769873352e.tar.gz compilertests-fb582b6ff0ba7b5a675c9fa95b8921769873352e.tar.bz2 |
some fixes around wrong ident handling
-rw-r--r-- | ecomp-c/ec.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ecomp-c/ec.c b/ecomp-c/ec.c index 2ab0fb1..dfd9d76 100644 --- a/ecomp-c/ec.c +++ b/ecomp-c/ec.c @@ -2087,8 +2087,8 @@ static void parseParameterDeclaration( Scope *scope ) { Symbol *symbol; - Expect( S_ident ); symbol = insert_symbol( scope, ident, SYMBOL_CLASS_VARIABLE ); + sym = getSym( ); /* TODO: allocate size for parameters on stack, make sure they * are allocated on the other side of the stack @@ -2121,7 +2121,9 @@ static void parseProcedureDeclaration( Scope *scope ) int size_params; Expect( S_procedure ); - Expect( S_ident ); + if( sym != S_ident ) { + Abort( "Expecting name of a procedure after 'procedure'" ); + } symbol = get_symbol( scope, ident ); if( symbol == NULL ) { @@ -2135,7 +2137,8 @@ static void parseProcedureDeclaration( Scope *scope ) /* local scope holding all local defitions */ symbol->scope = create_scope( scope, symbol->name ); - + + sym = getSym( ); if( sym == S_semicolon ) { /* no parameters */ sym = getSym( ); @@ -2300,10 +2303,10 @@ static void parseModule( Scope *scope ) char *entry_label; Expect( S_module ); - Expect( S_ident ); if( sym == S_ident ) { strlcpy( moduleName, ident, MAX_IDENT_LEN ); } + sym = getSym( ); entry_label = get_local_label( scope ); Emit( "jmp %s\n", entry_label ); |