From fb582b6ff0ba7b5a675c9fa95b8921769873352e Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 17 Aug 2020 20:02:44 +0200 Subject: some fixes around wrong ident handling --- ecomp-c/ec.c | 11 +++++++---- 1 file 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 ); -- cgit v1.2.3-54-g00ecf