File grammar.y changed (mode: 100644) (index 68afdaa..fd085ba) |
... |
... |
codeblock: /* empty */ { $$.ty = gEmpty; } |
495 |
495 |
; |
; |
496 |
496 |
|
|
497 |
497 |
statement: NEWLINE { $$.ty = gEmpty; } |
statement: NEWLINE { $$.ty = gEmpty; } |
498 |
|
| CALL funccall NEWLINE{ $$.ty = gNone;} |
|
|
498 |
|
| CALL funccall NEWLINE{ $$.ty = gAny;} |
499 |
499 |
/*1 2 3 4 5 6 7 8 9 */ |
/*1 2 3 4 5 6 7 8 9 */ |
500 |
500 |
| IF expr THEN NEWLINE codeblock elsifseq elseseq ENDIF NEWLINE { |
| IF expr THEN NEWLINE codeblock elsifseq elseseq ENDIF NEWLINE { |
501 |
501 |
canconvert($2.ty, gBoolean, -1); |
canconvert($2.ty, gBoolean, -1); |
|
... |
... |
statement: NEWLINE { $$.ty = gEmpty; } |
507 |
507 |
yyerrorline(3, lineno - 1, ebuf); |
yyerrorline(3, lineno - 1, ebuf); |
508 |
508 |
} |
} |
509 |
509 |
canconvert($4.ty, getVariable($2.str)->ty, -1); |
canconvert($4.ty, getVariable($2.str)->ty, -1); |
510 |
|
$$.ty = gNone; |
|
|
510 |
|
$$.ty = gAny; |
511 |
511 |
if (getVariable($2.str)->isconst) { |
if (getVariable($2.str)->isconst) { |
512 |
512 |
char ebuf[1024]; |
char ebuf[1024]; |
513 |
513 |
snprintf(ebuf, 1024, "Cannot assign to constant %s", $2.str); |
snprintf(ebuf, 1024, "Cannot assign to constant %s", $2.str); |
|
... |
... |
statement: NEWLINE { $$.ty = gEmpty; } |
521 |
521 |
} |
} |
522 |
522 |
| SET rid LBRACKET expr RBRACKET EQUALS expr NEWLINE{ |
| SET rid LBRACKET expr RBRACKET EQUALS expr NEWLINE{ |
523 |
523 |
const struct typeandname *tan = getVariable($2.str); |
const struct typeandname *tan = getVariable($2.str); |
524 |
|
$$.ty = gNone; |
|
|
524 |
|
$$.ty = gAny; |
525 |
525 |
if (tan->ty != gAny) { |
if (tan->ty != gAny) { |
526 |
526 |
canconvert($4.ty, gInteger, -1); |
canconvert($4.ty, gInteger, -1); |
527 |
527 |
if (!tan->isarray) { |
if (!tan->isarray) { |
|
... |
... |
statement: NEWLINE { $$.ty = gEmpty; } |
536 |
536 |
} |
} |
537 |
537 |
| loopstart NEWLINE codeblock loopend NEWLINE {$$.ty = $3.ty;} |
| loopstart NEWLINE codeblock loopend NEWLINE {$$.ty = $3.ty;} |
538 |
538 |
| loopstart NEWLINE codeblock {$$.ty = $3.ty; yyerrorex(0, "Missing endloop");} |
| loopstart NEWLINE codeblock {$$.ty = $3.ty; yyerrorex(0, "Missing endloop");} |
539 |
|
| EXITWHEN expr NEWLINE { canconvert($2.ty, gBoolean, -1); if (!inloop) yyerrorline(0, lineno - 1, "Exitwhen outside of loop"); $$.ty = gNone;} |
|
|
539 |
|
| EXITWHEN expr NEWLINE { canconvert($2.ty, gBoolean, -1); if (!inloop) yyerrorline(0, lineno - 1, "Exitwhen outside of loop"); $$.ty = gAny;} |
540 |
540 |
| RETURN expr NEWLINE { |
| RETURN expr NEWLINE { |
541 |
541 |
$$.ty = mkretty($2.ty, 1); |
$$.ty = mkretty($2.ty, 1); |
542 |
542 |
if(retval == gNothing) |
if(retval == gNothing) |
|
... |
... |
statement: NEWLINE { $$.ty = gEmpty; } |
549 |
549 |
yyerrorline(1, lineno - 1, "Return nothing in function that should return value"); |
yyerrorline(1, lineno - 1, "Return nothing in function that should return value"); |
550 |
550 |
$$.ty = mkretty(gAny, 1); |
$$.ty = mkretty(gAny, 1); |
551 |
551 |
} |
} |
552 |
|
| DEBUG statement {$$.ty = gNone;} |
|
|
552 |
|
| DEBUG statement {$$.ty = gAny;} |
553 |
553 |
/*1 2 3 4 5 6 7 */ |
/*1 2 3 4 5 6 7 */ |
554 |
554 |
| IF expr THEN NEWLINE codeblock elsifseq elseseq { |
| IF expr THEN NEWLINE codeblock elsifseq elseseq { |
555 |
555 |
canconvert($2.ty, gBoolean, -1); |
canconvert($2.ty, gBoolean, -1); |
|
... |
... |
statement: NEWLINE { $$.ty = gEmpty; } |
561 |
561 |
$$.ty = gAny; |
$$.ty = gAny; |
562 |
562 |
yyerrorex(0, "Missing then or non valid expression"); |
yyerrorex(0, "Missing then or non valid expression"); |
563 |
563 |
} |
} |
564 |
|
| SET funccall NEWLINE{$$.ty = gNone; yyerrorline(0, lineno - 1, "Call expected instead of set");} |
|
|
564 |
|
| SET funccall NEWLINE{$$.ty = gAny; yyerrorline(0, lineno - 1, "Call expected instead of set");} |
565 |
565 |
| lvardecl {yyerrorex(0, "Local declaration after first statement");} |
| lvardecl {yyerrorex(0, "Local declaration after first statement");} |
566 |
|
| error {$$.ty = gNone; } |
|
|
566 |
|
| error {$$.ty = gAny; } |
567 |
567 |
; |
; |
568 |
568 |
|
|
569 |
569 |
loopstart: LOOP {inloop++;} |
loopstart: LOOP {inloop++;} |