summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecomp-c/ec.c11
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 );