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 *** 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 594b07b664e8da134328e2099107f836c4783d22 - *** empty log message ***
Author: cilibrar
Author date (UTC): 2003-06-08 14:19
Committer name: cilibrar
Committer date (UTC): 2003-06-08 14:19
Parent(s): 7114936321546139b5512821e3d868b21c0b89f1
Signer:
Signing key:
Signing status: N
Tree: 60b4e6d749cf337eae24754206d30c974984ce79
File Lines added Lines deleted
src/grammar.y 7 8
src/misc.c 37 2
src/misc.h 6 2
File src/grammar.y changed (mode: 100644) (index 274ed5f..604f860)
12 12 int yyerror (char *s) /* Called by yyparse on error */ int yyerror (char *s) /* Called by yyparse on error */
13 13 { {
14 14 haderrors++; haderrors++;
15 printf ("%d: %s\n", lineno, s);
15 printf ("%s:%d: %s\n", curfile, lineno, s);
16 16 return 0; return 0;
17 17 } }
18 18
19 19 int main(int argc, char **argv) int main(int argc, char **argv)
20 20 { {
21 init();
21 init(argc, argv);
22 22 if (1) { if (1) {
23 for (;;) {
24 int result = yyparse();
25 if (result == 0) break;
26 }
23 doparse(argc, argv);
27 24 } }
28 25 else { else {
29 26 for (;;) { for (;;) {
 
... ... int main(int argc, char **argv)
33 30 } }
34 31 } }
35 32 if (!haderrors) { if (!haderrors) {
36 printf("Parse successful, no errors\n");
33 printf("Total parse successful: %d lines, no errors\n", totlines);
37 34 return 0; return 0;
38 35 } }
39 else
36 else {
37 printf("Parse failed: %d total errors\n", haderrors);
40 38 return 1; return 1;
39 }
41 40 } }
42 41
43 42 #define YYSTYPE union node #define YYSTYPE union node
File src/misc.c changed (mode: 100644) (index f9497e8..ed99897)
5 5 #include "grammar.tab.h" #include "grammar.tab.h"
6 6 #include "misc.h" #include "misc.h"
7 7
8 int lineno = 1;
8 int lineno;
9 9 int haderrors = 0; int haderrors = 0;
10 int totlines = 0;
10 11
11 12 int hashfunc(const char *name); int hashfunc(const char *name);
12 13 struct hashtable functions, globals, locals, params, types; struct hashtable functions, globals, locals, params, types;
13 14 struct hashtable *curtab; struct hashtable *curtab;
14 15 struct typenode *retval; struct typenode *retval;
16 char *curfile;
15 17 struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull; struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull;
16 18
17 19 void addPrimitiveType(const char *name, struct typenode **toSave) void addPrimitiveType(const char *name, struct typenode **toSave)
 
... ... void addPrimitiveType(const char *name, struct typenode **toSave)
19 21 put(&types, name, *toSave = newtypenode(name, NULL)); put(&types, name, *toSave = newtypenode(name, NULL));
20 22 } }
21 23
22 void init()
24 void init(int argc, char **argv)
23 25 { {
24 26 addPrimitiveType("handle", &gHandle); addPrimitiveType("handle", &gHandle);
25 27 addPrimitiveType("integer", &gInteger); addPrimitiveType("integer", &gInteger);
 
... ... void checkeqtest(const struct typenode *a, const struct typenode *b)
302 304 { {
303 305 checkcomparison(a, b); checkcomparison(a, b);
304 306 } }
307
308 void dofile(FILE *fp, const char *name)
309 {
310 void *cur;
311 lineno = 1;
312 int olderrs = haderrors;
313 cur = yy_create_buffer(fp, BUFSIZE);
314 yy_switch_to_buffer(cur);
315 curfile = name;
316 while (yyparse())
317 ;
318 if (olderrs == haderrors)
319 printf("%s parse successful, %d lines\n", curfile, lineno);
320 else
321 printf("%s failed with %d error%s\n", curfile, haderrors - olderrs,(haderrors == olderrs + 1) ? "s" : "");
322 totlines += lineno;
323 }
324
325 void doparse(int argc, char **argv)
326 {
327 int i;
328 for (i = 1; i < argc; ++i)
329 if (argv[i][0] == '-' && argv[i][1] == 0)
330 dofile(stdin, "<stdin>");
331 else {
332 FILE *fp;
333 fp = fopen(argv[i], "rb");
334 dofile(fp, argv[i]);
335 fclose(fp);
336 }
337 if (argc == 1)
338 dofile(stdin, "<stdin>");
339 }
File src/misc.h changed (mode: 100644) (index 80f791f..67daac7)
1 1 #include <stdio.h> #include <stdio.h>
2 2 #define YYDEBUG 1 #define YYDEBUG 1
3 3
4 #define BUFSIZE 8192
5
4 6
5 7 struct typenode { struct typenode {
6 8 char *typename; char *typename;
 
... ... struct typenode *binop(const struct typenode *a, const struct typenode *b);
63 65 int canconvert(const struct typenode *from, const struct typenode *to); int canconvert(const struct typenode *from, const struct typenode *to);
64 66 void checkParameters(const struct paramlist *func, const struct paramlist *inp); void checkParameters(const struct paramlist *func, const struct paramlist *inp);
65 67
66 extern int lineno;
68 extern int lineno, totlines;
67 69 extern int haderrors; extern int haderrors;
68 extern char *yytext;
70 extern char *yytext, *curfile;
69 71 extern int yydebug; extern int yydebug;
70 72 extern struct hashtable functions, globals, locals, params, types, *curtab; extern struct hashtable functions, globals, locals, params, types, *curtab;
71 73 extern struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull; extern struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull;
 
... ... const struct typeandname *getVariable(const char *varname);
74 76 void isnumeric(const struct typenode *ty); void isnumeric(const struct typenode *ty);
75 77 void checkcomparison(const struct typenode *a, const struct typenode *b); void checkcomparison(const struct typenode *a, const struct typenode *b);
76 78 void checkeqtest(const struct typenode *a, const struct typenode *b); void checkeqtest(const struct typenode *a, const struct typenode *b);
79 void init(int argc, char **argv);
80 void doparse(int argc, char **argv);
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