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)
*** empty log message *** a9084c6a8897b38d209f2f3839ed9fd8c17a5eb4 cilibrar 2003-06-08 15:59:21
*** empty log message *** 594b07b664e8da134328e2099107f836c4783d22 cilibrar 2003-06-08 14:19:39
A makefile for cygwin. 7114936321546139b5512821e3d868b21c0b89f1 cilibrar 2003-06-08 10:38:31
Added \n, \r, \t in double-quotes. Added debug keyword handling. Now it parses everything in the Scripts directory except demo.ai, which looks like it could never work anyway. a76d8de5a85768c58297ad05dcc3bd361e3c8d69 cilibrar 2003-06-08 10:12:17
Make downcasting bug a bit more restrictive to minimize future problems. 3bef4ca2d62e1de3fe70986de71a3da2b68ff25f cilibrar 2003-06-08 09:52:03
Fixed segfault involving undeclared variables by assuming they are integer. 76b34be901540214c21b8af681bcf42620ca0e21 cilibrar 2003-06-08 09:49:56
Fixed bug with string literal addition. Added unfortunate special case to canconvert to allow downcasts from base to derived. Waiting on Blizzard to fix this one. (such a cast appears in one place in Blizzard.j) 1384b0771dd6db4c6cb548fef3331f518509c68e cilibrar 2003-06-08 09:40:28
Allow null to be converted to code, string, and appropriate comparisons. a2a05f7938a46a6a873d0f3313af760900403c88 cilibrar 2003-06-08 07:50:23
lets begin edb29fca55a82526251fd7c671302425ed97d9bd cilibrar 2003-06-08 07:47:56
Commit a9084c6a8897b38d209f2f3839ed9fd8c17a5eb4 - *** empty log message ***
Author: cilibrar
Author date (UTC): 2003-06-08 15:59
Committer name: cilibrar
Committer date (UTC): 2003-06-08 15:59
Parent(s): 594b07b664e8da134328e2099107f836c4783d22
Signer:
Signing key:
Signing status: N
Tree: 6ea4e6b76583ef9c27efd67fe5384704e80a11ae
File Lines added Lines deleted
src/Makefile 5 5
src/Makefile.cygwin 8 5
src/grammar.y 6 6
src/misc.c 54 11
src/misc.h 7 0
src/token.l 6 1
File src/Makefile changed (mode: 100644) (index 5cf76b6..b752f22)
1 all: sc
1 all: pjass
2 2
3 sc: lex.yy.c grammar.tab.c grammar.tab.h misc.o
4 gcc lex.yy.c grammar.tab.c misc.c -lfl -o $@ -g
3 pjass: lex.yy.c grammar.tab.c grammar.tab.h misc.o
4 gcc -O2 lex.yy.c grammar.tab.c misc.c -lfl -o $@
5 5
6 6 lex.yy.c: token.l lex.yy.c: token.l
7 7 flex $< flex $<
 
... ... grammar.tab.h: grammar.y
13 13 bison -d $< bison -d $<
14 14
15 15 clean: clean:
16 rm grammar.tab.h grammar.tab.c lex.yy.c sc
16 rm grammar.tab.h grammar.tab.c lex.yy.c pjass
17 17
18 18 t: t:
19 ./sc <t.txt
19 ./pjass <t.txt
20 20
21 21 package: package:
22 22 tar Ccvfz ../ jass2.tar.gz jass2/Makefile jass2/grammar.y jass2/token.l jass2/misc.c jass2/misc.h jass2/readme.txt tar Ccvfz ../ jass2.tar.gz jass2/Makefile jass2/grammar.y jass2/token.l jass2/misc.c jass2/misc.h jass2/readme.txt
File src/Makefile.cygwin changed (mode: 100644) (index b4fee23..a248267)
1 all: sc
1 all: pjass
2 2
3 sc: lex.yy.c grammar.tab.c grammar.tab.h misc.o
4 gcc lex.yy.c grammar.tab.c misc.c -lfl -o $@ -g -mno-cygwin
3 pjass: lex.yy.c grammar.tab.c grammar.tab.h misc.o
4 gcc lex.yy.c grammar.tab.c misc.c -lfl -o $@ -O2 -mno-cygwin
5 5
6 6 lex.yy.c: token.l lex.yy.c: token.l
7 7 flex $< flex $<
 
... ... grammar.tab.h: grammar.y
13 13 bison -d $< bison -d $<
14 14
15 15 clean: clean:
16 rm grammar.tab.h grammar.tab.c lex.yy.c sc
16 rm grammar.tab.h grammar.tab.c lex.yy.c pjass.exe pjass
17 17
18 18 t: t:
19 ./sc <t.txt
19 ./pjass <t.txt
20 20
21 21 package: package:
22 22 tar Ccvfz ../ jass2.tar.gz jass2/Makefile jass2/grammar.y jass2/token.l jass2/misc.c jass2/misc.h jass2/readme.txt tar Ccvfz ../ jass2.tar.gz jass2/Makefile jass2/grammar.y jass2/token.l jass2/misc.c jass2/misc.h jass2/readme.txt
23
24 binpackage:
25 rm -f PJASS.zip ; pkzip -a pjass.zip ../doc/readme.txt ./pjass.exe ; mv -f PJASS.zip pjass-bin-091.zip
File src/grammar.y changed (mode: 100644) (index 604f860..80f12f3)
... ... int main(int argc, char **argv)
29 29 printf("Got result %d, %s\n", result, yytext); printf("Got result %d, %s\n", result, yytext);
30 30 } }
31 31 } }
32 if (!haderrors) {
33 printf("Total parse successful: %d lines, no errors\n", totlines);
32 if (!haderrors && didparse) {
33 printf("Parse successful: %8d lines: %s\n", totlines, "<total>");
34 34 return 0; return 0;
35 35 } }
36 36 else { else {
37 printf("Parse failed: %d total errors\n", haderrors);
37 if (haderrors)
38 printf("Parse failed: %d error%s total\n", haderrors, haderrors == 1 ? "" : "s");
39 else
40 printf("Parse failed\n");
38 41 return 1; return 1;
39 42 } }
40 43 } }
 
... ... intexpr: INTLIT { $$.ty = gInteger; }
241 244 ; ;
242 245
243 246
244 funccall: rid LPAREN exprlist RPAREN
245 ;
246
247 247 funcdecl: nativefuncdecl { $$.fd = $1.fd; } funcdecl: nativefuncdecl { $$.fd = $1.fd; }
248 248 | CONSTANT nativefuncdecl { $$.fd = $2.fd; } | CONSTANT nativefuncdecl { $$.fd = $2.fd; }
249 249 ; ;
File src/misc.c changed (mode: 100644) (index ed99897..c0444eb)
1 // Jass2 parser for bison/yacc
2 // by Rudi Cilibrasi
3 // Sun Jun 8 00:51:53 CEST 2003
4 // thanks to Jeff Pang for the handy documentation that this was based
5 // on at http://jass.sourceforge.net
6 // Released under the BSD license
1 7 #include <stdio.h> #include <stdio.h>
2 8 #include <string.h> #include <string.h>
3 9 #include <assert.h> #include <assert.h>
 
5 11 #include "grammar.tab.h" #include "grammar.tab.h"
6 12 #include "misc.h" #include "misc.h"
7 13
14 #define VERSIONSTR "0.91"
15
8 16 int lineno; int lineno;
9 int haderrors = 0;
10 int totlines = 0;
17 int haderrors;
18 int totlines;
19 int didparse;
11 20
12 21 int hashfunc(const char *name); int hashfunc(const char *name);
13 22 struct hashtable functions, globals, locals, params, types; struct hashtable functions, globals, locals, params, types;
 
... ... void dofile(FILE *fp, const char *name)
316 325 while (yyparse()) while (yyparse())
317 326 ; ;
318 327 if (olderrs == haderrors) if (olderrs == haderrors)
319 printf("%s parse successful, %d lines\n", curfile, lineno);
328 printf("Parse successful: %8d lines: %s\n", lineno, curfile);
320 329 else else
321 printf("%s failed with %d error%s\n", curfile, haderrors - olderrs,(haderrors == olderrs + 1) ? "s" : "");
330 printf("%s failed with %d error%s\n", curfile, haderrors - olderrs,(haderrors == olderrs + 1) ? "" : "s");
322 331 totlines += lineno; totlines += lineno;
323 332 } }
324 333
334 void printversion()
335 {
336 printf("pjass version %s by Rudi Cilibrasi\n", VERSIONSTR);
337 }
338
325 339 void doparse(int argc, char **argv) void doparse(int argc, char **argv)
326 340 { {
327 341 int i; int i;
328 for (i = 1; i < argc; ++i)
329 if (argv[i][0] == '-' && argv[i][1] == 0)
342 for (i = 1; i < argc; ++i) {
343 if (argv[i][0] == '-' && argv[i][1] == 0) {
330 344 dofile(stdin, "<stdin>"); dofile(stdin, "<stdin>");
331 else {
332 FILE *fp;
333 fp = fopen(argv[i], "rb");
334 dofile(fp, argv[i]);
335 fclose(fp);
345 didparse = 1;
346 continue;
347 }
348 if (strcmp(argv[i], "-h") == 0) {
349 printversion();
350 printf(
351 "To use this program, list the files you would like to parse in order.\n"
352 "If you would like to parse from standard input (the keyboard), then\n"
353 "use - as an argument. If you supply no arguments to pjass, it will\n"
354 "parse the console standard input by default.\n"
355 "To test this program, go into your Scripts directory, and type:\n"
356 "pjass common.j common.ai Blizzard.j\n"
357 "pjass accepts some options:\n"
358 "pjass -h Display this help\n"
359 "pjass -v Display version information and exit\n"
360 "pjass - Read from standard input (may appear in a list)\n"
361 );
362 exit(0);
363 continue;
364 }
365 if (strcmp(argv[i], "-v") == 0) {
366 printf("%s version %s\n", argv[0], VERSIONSTR);
367 exit(0);
368 continue;
369 }
370 FILE *fp;
371 fp = fopen(argv[i], "rb");
372 if (fp == NULL) {
373 printf("Error: Cannot open %s\n", argv[i]);
374 continue;
336 375 } }
376 dofile(fp, argv[i]);
377 didparse = 1;
378 fclose(fp);
379 }
337 380 if (argc == 1) if (argc == 1)
338 381 dofile(stdin, "<stdin>"); dofile(stdin, "<stdin>");
339 382 } }
File src/misc.h changed (mode: 100644) (index 67daac7..e75a46a)
1 // Jass2 parser for bison/yacc
2 // by Rudi Cilibrasi
3 // Sun Jun 8 00:51:53 CEST 2003
4 // thanks to Jeff Pang for the handy documentation that this was based
5 // on at http://jass.sourceforge.net
6 // Released under the BSD license
1 7 #include <stdio.h> #include <stdio.h>
2 8 #define YYDEBUG 1 #define YYDEBUG 1
3 9
 
... ... void checkParameters(const struct paramlist *func, const struct paramlist *inp);
67 73
68 74 extern int lineno, totlines; extern int lineno, totlines;
69 75 extern int haderrors; extern int haderrors;
76 extern int didparse;
70 77 extern char *yytext, *curfile; extern char *yytext, *curfile;
71 78 extern int yydebug; extern int yydebug;
72 79 extern struct hashtable functions, globals, locals, params, types, *curtab; extern struct hashtable functions, globals, locals, params, types, *curtab;
File src/token.l changed (mode: 100644) (index 80fb4ab..1c7a506)
1 /* scanner for a toy Pascal-like language */
1 /* Jass2 parser for bison/yacc */
2 /* by Rudi Cilibrasi */
3 /* Sun Jun 8 00:51:53 CEST 2003 */
4 /* thanks to Jeff Pang for the handy documentation that this was based */
5 /* on at http://jass.sourceforge.net */
6 /* Released under the BSD license */
2 7
3 8 %{ %{
4 9 /* need this for the call to atof() below */ /* need this for the call to atof() below */
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