vrtc / pjass (public) (License: BSD) (since 2023-08-03) (hash sha1)
pjass is a free Jass scripting language parser. This repository is a fork of lep/pjass. The goal is to add Debian packaging. As of the time of this writing, it works for current stable, that is Debian 12 (bookworm).
List of commits:
Subject Hash Author Date (UTC)
Missing-return checks also checks elseifs. 889122b0fb788663c728127520d0e7124c2a040c lep 2015-02-03 15:18:12
Fixed some more warnings. a5ae36b5299ac419a91592b60b8fcb1dfd8f4374 lep 2015-02-03 13:24:56
Added early exit to editdistance function. 82e8d024392d357d56c833c6b7f7632ffd6830a8 lep 2015-02-02 16:13:40
Unidentified variables are now marked as initialized. f3ef715b90782bc22fbdd29e1c16d7c917f407a9 lep 2015-02-02 13:56:00
Fixed bug in editdistance. a786775b057fc5795db1b2b106b7b9e3c1df6c4c lep 2015-02-02 13:41:15
Added basic uninitialized variable check for locals. c8222a6f68e44a46624c1f9ee781f590522f45f6 lep 2015-02-02 12:41:25
Added git-versionstring. e13ce6d7d90bccd8e18de6d0b01a18ea4501862b lep 2015-02-01 14:56:01
Removed returnsbool-check for Filter/Condition. e26a973fe1fdc1af999633c8d1f29afcbae76f0b lep 2015-02-01 14:51:47
Fixed some bison warnings. aca6b13e73d95c41787a7a0fdcc33407247be3a8 lep 2015-02-01 14:49:55
Removed multiline comments. e6d3a1bb5099bbf6e3a4ef2501645b15908a1ce8 lep 2015-02-01 14:49:16
Removed unnecessary tokens. 4f37057dfd472c2a400d667a6f7a3762cac01dcd lep 2015-02-01 14:48:14
Comments now work with EOF in addition to newlines at the end. 5363d3ca429da30594f7afb9d351335912b03fbd lep 2015-02-01 14:46:09
pjass 10n 2b2d35bc58dc93bc68014711cda919cecff13b4a lep 2014-10-25 20:38:00
pjass 10m 265bac6343dfeb09e1fc0af5c06571c7dc172455 Deaod 2010-02-15 12:15:00
pjass 10l 0c9161120896904b55b3cdd7b2f7430dd97f82e9 PitzerMike 2009-06-15 21:30:00
pjass 10k 43c1a8a167cdf2982af2c47056beeafcd1840537 Zoxc 2009-04-03 21:23:00
pjass 10j 16bbe625b7670a7affcf495e3370224c30582bca PitzerMike 2007-10-09 09:22:00
pjass 10i 1ecf3d1238619358a0aa9b1b919ed9ba97d36f84 PitzerMike 2007-09-29 11:57:00
pjass 10h dcb319607e8bb35637f86918962610683ada2b08 PitzerMike 2007-09-13 23:49:00
pjass 10g a5070a4d74abc627160481e592233fa26870d57a PitzerMike 2007-08-24 10:43:00
Commit 889122b0fb788663c728127520d0e7124c2a040c - Missing-return checks also checks elseifs.
Author: lep
Author date (UTC): 2015-02-03 15:18
Committer name: lep
Committer date (UTC): 2015-02-03 15:18
Parent(s): a5ae36b5299ac419a91592b60b8fcb1dfd8f4374
Signer:
Signing key:
Signing status: N
Tree: 4e9edbf7256f721d76200df153d7bcfa72546aa8
File Lines added Lines deleted
grammar.y 74 18
misc.c 6 5
File grammar.y changed (mode: 100644) (index 382ef50..ebd5e33)
... ... funccall: rid LPAREN exprlistcompl RPAREN {
294 294 sprintf(ebuf, "Undeclared function %s", $1.str); sprintf(ebuf, "Undeclared function %s", $1.str);
295 295 getsuggestions($1.str, ebuf, 1, &functions); getsuggestions($1.str, ebuf, 1, &functions);
296 296 yyerrorex(3, ebuf); yyerrorex(3, ebuf);
297 $$.ty = gNull;
297 $$.ty = gAny;
298 298 } else { } else {
299 299 if (inconstant && !(fd->isconst)) { if (inconstant && !(fd->isconst)) {
300 300 char ebuf[1024]; char ebuf[1024];
 
... ... funccall: rid LPAREN exprlistcompl RPAREN {
315 315 sprintf(ebuf, "Undeclared function %s", $1.str); sprintf(ebuf, "Undeclared function %s", $1.str);
316 316 getsuggestions($1.str, ebuf, 1, &functions); getsuggestions($1.str, ebuf, 1, &functions);
317 317 yyerrorex(3, ebuf); yyerrorex(3, ebuf);
318 $$.ty = gNull;
318 $$.ty = gAny;
319 319 } else if (inconstant && !(fd->isconst)) { } else if (inconstant && !(fd->isconst)) {
320 320 char ebuf[1024]; char ebuf[1024];
321 321 sprintf(ebuf, "Call to non-constant function %s in constant function", $1.str); sprintf(ebuf, "Call to non-constant function %s in constant function", $1.str);
322 322 yyerrorex(3, ebuf); yyerrorex(3, ebuf);
323 $$.ty = gNull;
323 $$.ty = gAny;
324 324 } else { } else {
325 325 if (fd == fCurrent && fCurrent) if (fd == fCurrent && fCurrent)
326 326 yyerrorex(3, "Recursive function calls are not permitted in local declarations"); yyerrorex(3, "Recursive function calls are not permitted in local declarations");
 
... ... funcdefn: NEWLINE
389 389 | statement { yyerrorex(0, "Statement outside of function"); } | statement { yyerrorex(0, "Statement outside of function"); }
390 390 ; ;
391 391
392 funcdefncore: funcbegin localblock codeblock funcend { if(retval != gNothing) { if ($3.ty == gAny || $3.ty == gNone) yyerrorline(1, lineno - 1, "Missing return"); else if (returnbug) canconvertreturn($3.ty, retval, -1); } }
392 funcdefncore: funcbegin localblock codeblock funcend {
393 if(retval != gNothing) {
394 if ($3.ty == gAny || $3.ty == gNone)
395 yyerrorline(1, lineno - 1, "Missing return");
396 else if (returnbug)
397 canconvertreturn($3.ty, retval, -1);
398 }
399 }
393 400 | funcbegin localblock codeblock {yyerrorex(0, "Missing endfunction"); clear(&params); clear(&locals); clear(&initialized); curtab = &globals;} | funcbegin localblock codeblock {yyerrorex(0, "Missing endfunction"); clear(&params); clear(&locals); clear(&initialized); curtab = &globals;}
394 401 ; ;
395 402
 
... ... funcbegin: FUNCTION rid TAKES optparam_list returnorreturns opttype {
480 487 } }
481 488 ; ;
482 489
483 codeblock: /* empty */ {$$.ty = gAny;}
484 | statement codeblock { if($2.ty == gAny) $$.ty = $1.ty; else $$.ty = $2.ty;}
490 codeblock: /* empty */ { $$.ty = gNull; }
491 | statement codeblock {
492 if($2.ty == gNull)
493 $$.ty = $1.ty;
494 else
495 $$.ty = $2.ty;
496 }
485 497 ; ;
486 498
487 statement: NEWLINE {$$.ty = gAny;}
499 statement: NEWLINE { $$.ty = gNull; }
488 500 | CALL funccall NEWLINE{ $$.ty = gNone;} | CALL funccall NEWLINE{ $$.ty = gNone;}
489 | IF expr THEN NEWLINE codeblock elsifseq elseseq ENDIF NEWLINE { canconvert($2.ty, gBoolean, -1); $$.ty = combinetype($6.ty!=gAny?combinetype($5.ty, $6.ty):$5.ty, $7.ty);}
501 /*1 2 3 4 5 6 7 8 9 */
502 | IF expr THEN NEWLINE codeblock elsifseq elseseq ENDIF NEWLINE {
503 canconvert($2.ty, gBoolean, -1);
504 $5.ty = $5.ty == gNull ? gNone : $5.ty;
505 $6.ty = $6.ty == gNull ? gNull : $6.ty;
506 $7.ty = $7.ty == gNull ? gNone : $7.ty;
507 $$.ty = combinetype($5.ty, combinetype($6.ty, $7.ty));
508 }
490 509 | SET rid EQUALS expr NEWLINE { if (getVariable($2.str)->isarray) { | SET rid EQUALS expr NEWLINE { if (getVariable($2.str)->isarray) {
491 510 char ebuf[1024]; char ebuf[1024];
492 511 sprintf(ebuf, "Index missing for array variable %s", $2.str); sprintf(ebuf, "Index missing for array variable %s", $2.str);
 
... ... statement: NEWLINE {$$.ty = gAny;}
508 527 | SET rid LBRACKET expr RBRACKET EQUALS expr NEWLINE{ | SET rid LBRACKET expr RBRACKET EQUALS expr NEWLINE{
509 528 const struct typeandname *tan = getVariable($2.str); const struct typeandname *tan = getVariable($2.str);
510 529 if (tan->ty != gAny) { if (tan->ty != gAny) {
511 canconvert($4.ty, gInteger, -1); $$.ty = gNone;
530 canconvert($4.ty, gInteger, -1);
531 $$.ty = gNone;
512 532 if (!tan->isarray) { if (!tan->isarray) {
513 533 char ebuf[1024]; char ebuf[1024];
514 534 sprintf(ebuf, "%s is not an array", $2.str); sprintf(ebuf, "%s is not an array", $2.str);
 
... ... statement: NEWLINE {$$.ty = gAny;}
522 542 | loopstart NEWLINE codeblock loopend NEWLINE {$$.ty = $3.ty;} | loopstart NEWLINE codeblock loopend NEWLINE {$$.ty = $3.ty;}
523 543 | loopstart NEWLINE codeblock {$$.ty = $3.ty; yyerrorex(0, "Missing endloop");} | loopstart NEWLINE codeblock {$$.ty = $3.ty; yyerrorex(0, "Missing endloop");}
524 544 | EXITWHEN expr NEWLINE { canconvert($2.ty, gBoolean, -1); if (!inloop) yyerrorline(0, lineno - 1, "Exitwhen outside of loop"); $$.ty = gNone;} | EXITWHEN expr NEWLINE { canconvert($2.ty, gBoolean, -1); if (!inloop) yyerrorline(0, lineno - 1, "Exitwhen outside of loop"); $$.ty = gNone;}
525 | RETURN expr NEWLINE { $$.ty = $2.ty; if(retval == gNothing) yyerrorline(1, lineno - 1, "Cannot return value from function that returns nothing"); else if (!returnbug) canconvertreturn($2.ty, retval, 0); }
526 | RETURN NEWLINE { if (retval != gNothing) yyerrorline(1, lineno - 1, "Return nothing in function that should return value"); $$.ty = gNone;}
545 | RETURN expr NEWLINE {
546 $$.ty = $2.ty;
547 if(retval == gNothing)
548 yyerrorline(1, lineno - 1, "Cannot return value from function that returns nothing");
549 else if (!returnbug)
550 canconvertreturn($2.ty, retval, 0);
551 }
552 | RETURN NEWLINE {
553 if (retval != gNothing)
554 yyerrorline(1, lineno - 1, "Return nothing in function that should return value");
555 $$.ty = gAny;
556 }
527 557 | DEBUG statement {$$.ty = gNone;} | DEBUG statement {$$.ty = gNone;}
528 | IF expr THEN NEWLINE codeblock elsifseq elseseq {canconvert($2.ty, gBoolean, 0); $$.ty = combinetype($6.ty!=gAny?combinetype($5.ty, $6.ty):$5.ty, $7.ty); yyerrorex(0, "Missing endif");}
529 | IF expr NEWLINE{canconvert($2.ty, gBoolean, -1); $$.ty = gAny; yyerrorex(0, "Missing then or non valid expression");}
558 /*1 2 3 4 5 6 7 */
559 | IF expr THEN NEWLINE codeblock elsifseq elseseq {
560 canconvert($2.ty, gBoolean, -1);
561 $5.ty = $5.ty == gNull ? gNone : $5.ty;
562 $6.ty = $6.ty == gNull ? gNull : $6.ty;
563 $7.ty = $7.ty == gNull ? gNone : $7.ty;
564 $$.ty = combinetype($5.ty, combinetype($6.ty, $7.ty));
565 yyerrorex(0, "Missing endif");
566 }
567 | IF expr NEWLINE {
568 canconvert($2.ty, gBoolean, -1);
569 $$.ty = gAny;
570 yyerrorex(0, "Missing then or non valid expression");
571 }
530 572 | SET funccall NEWLINE{$$.ty = gNone; yyerrorline(0, lineno - 1, "Call expected instead of set");} | SET funccall NEWLINE{$$.ty = gNone; yyerrorline(0, lineno - 1, "Call expected instead of set");}
531 573 | lvardecl {yyerrorex(0, "Local declaration after first statement");} | lvardecl {yyerrorex(0, "Local declaration after first statement");}
532 574 | error {$$.ty = gNone; } | error {$$.ty = gNone; }
 
... ... loopstart: LOOP {inloop++;}
538 580 loopend: ENDLOOP {inloop--;} loopend: ENDLOOP {inloop--;}
539 581 ; ;
540 582
541 elseseq: /* empty */ {$$.ty = gNone;}
542 | ELSE NEWLINE codeblock {$$.ty = $3.ty;}
583 elseseq: /* empty */ { $$.ty = gNull; }
584 | ELSE NEWLINE codeblock {
585 if($3.ty == gNull) {
586 $$.ty = gNone;
587 } else {
588 $$.ty = $3.ty;
589 }
590 }
543 591 ; ;
544 592
545 elsifseq: /* empty */ {$$.ty = gAny;}
546 | ELSEIF expr THEN NEWLINE codeblock elsifseq { canconvert($2.ty, gBoolean, -1); $$.ty = $6.ty!=gAny?combinetype($5.ty, $6.ty):$5.ty;}
593 elsifseq: /* empty */ { $$.ty = gNull; }
594 /* 1 2 3 4 5 6 */
595 | ELSEIF expr THEN NEWLINE codeblock elsifseq {
596 canconvert($2.ty, gBoolean, -1);
597 if($6.ty == gNull){
598 $$.ty = $5.ty == gNull ? gNone : $5.ty;
599 }else{
600 $$.ty = $5.ty == gNull ? gNone : combinetype($5.ty, $6.ty);
601 }
602 }
547 603 ; ;
548 604
549 605 optparam_list: param_list { $$.pl = $1.pl; } optparam_list: param_list { $$.pl = $1.pl; }
 
... ... type: primtype { $$.ty = $1.ty; }
779 835 sprintf(buf, "Undefined type %s", $1.str); sprintf(buf, "Undefined type %s", $1.str);
780 836 getsuggestions($1.str, buf, 1, &types); getsuggestions($1.str, buf, 1, &types);
781 837 yyerrorex(3, buf); yyerrorex(3, buf);
782 $$.ty = gNull;
838 $$.ty = gAny;
783 839 } }
784 840 else else
785 841 $$.ty = lookup(&types, $1.str); $$.ty = lookup(&types, $1.str);
File misc.c changed (mode: 100644) (index 4a5ad04..bb467c3)
... ... struct hashtable *curtab;
40 40 struct typenode *retval, *retcheck; struct typenode *retval, *retcheck;
41 41 const char *curfile; const char *curfile;
42 42 struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull, *gAny, *gNone, *gCodeReturnsBoolean, *gCodeReturnsNoBoolean; struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull, *gAny, *gNone, *gCodeReturnsBoolean, *gCodeReturnsNoBoolean;
43 struct typenode *gEmpty;
43 44 struct funcdecl *fCurrent; struct funcdecl *fCurrent;
44 45
45 46 void addPrimitiveType(const char *name, struct typenode **toSave) void addPrimitiveType(const char *name, struct typenode **toSave)
 
... ... void showtypenode(const struct typenode *td)
321 322 extends = ebuf; extends = ebuf;
322 323 } }
323 324 */ */
324 printf("%s%s", td->typename, extends);
325 printf("%s %s \n", td->typename, extends);
325 326 } }
326 327
327 328 void showfuncdecl(struct funcdecl *fd) void showfuncdecl(struct funcdecl *fd)
 
... ... int canconvertreturn(const struct typenode *ufrom, const struct typenode *uto, c
497 498 struct typenode *combinetype(const struct typenode *n1, const struct typenode *n2) { struct typenode *combinetype(const struct typenode *n1, const struct typenode *n2) {
498 499 if ((n1 == gNone) || (n2 == gNone)) return gNone; if ((n1 == gNone) || (n2 == gNone)) return gNone;
499 500 if (n1 == n2) return n1; if (n1 == n2) return n1;
500 if (n1 == gNull)
501 if (n1 == gNull || n1 == gAny)
501 502 return n2; return n2;
502 if (n2 == gNull)
503 if (n2 == gNull || n2 == gAny)
503 504 return n1; return n1;
504 505 n1 = getPrimitiveAncestor(n1); n1 = getPrimitiveAncestor(n1);
505 506 n2 = getPrimitiveAncestor(n2); n2 = getPrimitiveAncestor(n2);
506 507 if (n1 == n2) return n1; if (n1 == n2) return n1;
507 if (n1 == gNull)
508 if (n1 == gNull || n1 == gAny)
508 509 return n2; return n2;
509 if (n2 == gNull)
510 if (n2 == gNull || n2 == gAny)
510 511 return n1; return n1;
511 512 if ((n1 == gInteger) && (n2 == gReal)) if ((n1 == gInteger) && (n2 == gReal))
512 513 return gReal; return gReal;
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/pjass

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/pjass

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/pjass

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main