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)
Rewrote rawcode handling for somewhat better error messages. 1e687d921b09149e244d16d7abca398c0639ad6d lep 2015-02-08 20:08:22
Undefined variables are not suggested for other undefined variables. c5561c56dde18bbcf1d05bdec7b50804757c5ef8 lep 2015-02-08 15:39:10
Also changed gNone to gAny in else and elesif cases. 485e75aaa14eb8ae10058305f7b75c1abd19eb82 lep 2015-02-06 15:20:15
Changed statement default return type from gNone to gAny. 7a054ad7b62d77ae4a17ac97d913a19675dad111 lep 2015-02-06 15:12:31
Propagate returncheck through statements. b8977b07e11f8fd335851e3a2d69cb473492f85b lep 2015-02-06 15:07:36
Small changes. Removed some unused symbols. 83c8b2b0e6811380bddf6e92e3b2f843370d5e05 lep 2015-02-05 12:43:24
Only put locals into the initialized table. db20d22434506716774fa4e8577f98073f17d6c2 lep 2015-02-04 11:57:00
Changed min function to min makro. b5b6c824896935232743633ae57d060e5c6a046f lep 2015-02-04 11:33:14
Rewrote the hashtable. 55c0f9ae7d284df88c48e7c2ac1c547cda1d802a lep 2015-02-04 11:24:53
Fixed some memory violations. 26a99d799804d8154c4ee1aa0850cdaad909d1ae lep 2015-02-03 23:27:32
Reverted smth. dbd5c217795cf5cd014ed7370655e62591d4d0fe lep 2015-02-03 22:12:49
Changed sprintf to snprintf. 02d6efe2aed9186b2e6189b36a5fa50d2e0c2221 lep 2015-02-03 21:33:05
Wrapped typenode member accesses in getTypePtr. 372c1f9da68a65de9e14dff3881e1758d5e7114b lep 2015-02-03 21:05:11
Added ifdefs for memalign functionality. f005f5e8067994ebd76265e3289e6ab67283b96f lep 2015-02-03 20:06:20
Missing-return check in elseifs should work now. 4274d6166e2c92a4591c1e46a0d71f1579a57c7d lep 2015-02-03 19:35:39
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
Commit 1e687d921b09149e244d16d7abca398c0639ad6d - Rewrote rawcode handling for somewhat better error messages.
Author: lep
Author date (UTC): 2015-02-08 20:08
Committer name: lep
Committer date (UTC): 2015-02-08 20:08
Parent(s): c5561c56dde18bbcf1d05bdec7b50804757c5ef8
Signer:
Signing key:
Signing status: N
Tree: c1ec0285fa4c3f61c997054c125ffa32b3da6e88
File Lines added Lines deleted
grammar.y 2 4
misc.c 5 4
misc.h 1 1
token.l 34 31
File grammar.y changed (mode: 100644) (index ccb2c09..a3277eb)
11 11
12 12 #define YYMAXDEPTH 100000 #define YYMAXDEPTH 100000
13 13
14 int yyerrorline (int errorlevel, int line, char *s)
14 void yyerrorline (int errorlevel, int line, char *s)
15 15 { {
16 16 if (showerrorlevel[errorlevel]) { if (showerrorlevel[errorlevel]) {
17 17 haderrors++; haderrors++;
18 18 printf ("%s:%d: %s\n", curfile, line, s); printf ("%s:%d: %s\n", curfile, line, s);
19 return 0;
20 19 } }
21 20 else else
22 21 ignorederrors++; ignorederrors++;
23 22 } }
24 23
25 int yyerrorex (int errorlevel, char *s)
24 void yyerrorex (int errorlevel, char *s)
26 25 { {
27 26 if (showerrorlevel[errorlevel]) { if (showerrorlevel[errorlevel]) {
28 27 haderrors++; haderrors++;
29 28 printf ("%s:%d: %s\n", curfile, lineno, s); printf ("%s:%d: %s\n", curfile, lineno, s);
30 return 0;
31 29 } }
32 30 else else
33 31 ignorederrors++; ignorederrors++;
File misc.c changed (mode: 100644) (index c28bbbe..8447f57)
... ... int inloop;
35 35 int afterendglobals; int afterendglobals;
36 36 int *showerrorlevel; int *showerrorlevel;
37 37
38 uint32_t hashfunc(const char *name, int size);
38 uint32_t hashfunc(const char *name);
39 void inittable(struct hashtable*, int);
39 40 struct hashtable functions, globals, locals, params, types, initialized; struct hashtable functions, globals, locals, params, types, initialized;
40 41 struct hashtable *curtab; struct hashtable *curtab;
41 42 struct typenode *retval, *retcheck; struct typenode *retval, *retcheck;
 
... ... void showfuncdecl(struct funcdecl *fd)
360 361 } }
361 362
362 363
363 uint32_t hashfunc(const char *key, int size) {
364 uint32_t hashfunc(const char *key) {
364 365 //murmur3_32 //murmur3_32
365 366 static const uint32_t c1 = 0xcc9e2d51; static const uint32_t c1 = 0xcc9e2d51;
366 367 static const uint32_t c2 = 0x1b873593; static const uint32_t c2 = 0x1b873593;
 
... ... void inittable(struct hashtable *h, int size){
420 421
421 422 void *lookup(struct hashtable *h, const char *name) void *lookup(struct hashtable *h, const char *name)
422 423 { {
423 int start = hashfunc(name, h->size);
424 int start = hashfunc(name);
424 425 int idx = (start + 1) % h->size; int idx = (start + 1) % h->size;
425 426 for(; idx != start; idx = (idx + 1) % h->size){ for(; idx != start; idx = (idx + 1) % h->size){
426 427 if(h->bucket[idx].name){ if(h->bucket[idx].name){
 
... ... void put(struct hashtable *h, const char *name, void *val)
459 460 return; return;
460 461 } }
461 462
462 int start = hashfunc(name, h->size);
463 int start = hashfunc(name);
463 464 int idx = (start + 1) % h->size; int idx = (start + 1) % h->size;
464 465 for(; /*idx != start*/; idx = (idx + 1) % h->size){ for(; /*idx != start*/; idx = (idx + 1) % h->size){
465 466 if(!h->bucket[idx].name){ if(!h->bucket[idx].name){
File misc.h changed (mode: 100644) (index f190fc7..8fa8b32)
... ... int canconvert(const struct typenode *from, const struct typenode *to, const int
75 75 int canconvertreturn(const struct typenode *from, const struct typenode *to, const int linemod); int canconvertreturn(const struct typenode *from, const struct typenode *to, const int linemod);
76 76 struct typenode* mkretty(struct typenode *ty, int ret); struct typenode* mkretty(struct typenode *ty, int ret);
77 77 struct typenode* getTypePtr(struct typenode *ty); struct typenode* getTypePtr(struct typenode *ty);
78 getTypeTag(struct typenode *ty);
78 int getTypeTag(struct typenode *ty);
79 79 int typeeq(struct typenode*, struct typenode*); int typeeq(struct typenode*, struct typenode*);
80 80 struct typenode *combinetype(struct typenode *n1, struct typenode *n2); struct typenode *combinetype(struct typenode *n1, struct typenode *n2);
81 81 void checkParameters(const struct paramlist *func, const struct paramlist *inp); void checkParameters(const struct paramlist *func, const struct paramlist *inp);
File token.l changed (mode: 100644) (index 22ec4a6..a59add3)
... ... int yywrap()
13 13 return 1; return 1;
14 14 } }
15 15
16 int rawcodelen;
17 int rawcodespecial;
18 int rawcodestartline;
19
16 20 #include "grammar.tab.h" #include "grammar.tab.h"
17 21 #include "misc.h" #include "misc.h"
18 22
 
... ... ID [a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?
27 31 SPACE [ \t] SPACE [ \t]
28 32 TABS [\x01-\x09\x0B\x0C\x0E-\x1F] TABS [\x01-\x09\x0B\x0C\x0E-\x1F]
29 33 STRINGSTART ["] STRINGSTART ["]
30 RAWCODESTART [']
34
35 %x RAWCODE
31 36
32 37 %% %%
33 38
 
... ... RAWCODESTART [']
40 45 return NEWLINE; return NEWLINE;
41 46 } }
42 47
43 {RAWCODESTART} {
44 int prevChar = 0;
45 int curChar = input();
46 int special = 0;
47 int count = 0;
48 for(;;){
49 if (prevChar == '\r' && curChar != '\r') {
50 lineno++;
51 }
52 if(curChar == EOF){
53 break;
54 }else if (prevChar == '\\'){
55 if(count != 1){
56 yyerrorline(3, lineno, "Escaped chars are only allowed if they are the only char in the rawcode.");
57 }else{
58 if (curChar != 'b' && curChar != 't' && curChar != 'r' && curChar != 'n' && curChar != 'f' && curChar != '\'' && curChar != '\\')
59 yyerrorline(3, lineno, "Invalid escape character sequence");
60 curChar = 0;
61 special = 1;
62 }
63 }else if (curChar == '\''){
64 if(count != 4 && count - special != 1){
65 yyerrorline(3, lineno, "Rawcodes must be 1 or 4 characters.");
66 }
67 break;
48 [']\\[btrnf"\\]['] { return UNITTYPEINT; }
49 [']\\.['] {
50 yyerrorline(3, lineno, "Invalid escape character sequence");
51 return UNITTYPEINT;
52 }
53
54 ['] {
55 BEGIN(RAWCODE);
56 rawcodelen = 0;
57 rawcodestartline = lineno;
58 }
59 <RAWCODE>['] {
60 if(rawcodelen != 4 && rawcodelen != 1){
61 yyerrorline(3, rawcodestartline, "Rawcodes must consist of 1 or 4 characters");
68 62 } }
69 count++;
70 prevChar = curChar;
71 curChar = input();
63 BEGIN(INITIAL);
64 return UNITTYPEINT;
72 65 } }
73 return UNITTYPEINT;
74 }
66
67 <RAWCODE>\\[btrnf"\\] {
68 rawcodelen++;
69 yyerrorline(3, rawcodestartline, "Escaped chars are only allowed if they are the only char in the rawcode.");
70 }
71 <RAWCODE>\\. {
72 yyerrorline(3, lineno, "Invalid escape character sequence");
73 rawcodelen++;
74 }
75 <RAWCODE>\r*\n { lineno++; isconstant = 0; rawcodelen += strlen(yytext) ;}
76 <RAWCODE>. { rawcodelen++; }
77
75 78
76 79 {STRINGSTART} { int prevChar = 0; {STRINGSTART} { int prevChar = 0;
77 80 int curChar = input(); int curChar = input();
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