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)
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 1384b0771dd6db4c6cb548fef3331f518509c68e - 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)
Author: cilibrar
Author date (UTC): 2003-06-08 09:40
Committer name: cilibrar
Committer date (UTC): 2003-06-08 09:40
Parent(s): a2a05f7938a46a6a873d0f3313af760900403c88
Signer:
Signing key:
Signing status: N
Tree: c65f5ad6f9550ae7597172c687649136c75a8714
File Lines added Lines deleted
src/grammar.y 8 8
src/misc.c 12 0
src/misc.h 1 0
src/token.l 1 1
File src/grammar.y changed (mode: 100644) (index 13c96c6..4911ce2)
... ... int main(int argc, char **argv)
102 102 %token UNITTYPEINT %token UNITTYPEINT
103 103 %token EQUALS %token EQUALS
104 104
105 %right EQUALS
105 106 %left AND OR %left AND OR
106 107 %left NOT %left NOT
107 108 %left LESS GREATER EQCOMP NEQ LEQ GEQ %left LESS GREATER EQCOMP NEQ LEQ GEQ
108 %right EQUALS
109 109 %left MINUS PLUS %left MINUS PLUS
110 110 %left TIMES DIV %left TIMES DIV
111 111
 
... ... td: NEWLINE
150 150 ; ;
151 151
152 152 // Returns a typenode // Returns a typenode
153 expr: intexpr
154 | realexpr
155 | stringexpr
156 | boolexpr
153 expr: intexpr { $$.ty = gInteger; }
154 | realexpr { $$.ty = gReal; }
155 | stringexpr { $$.ty = gString; }
156 | boolexpr { $$.ty = gBoolean; }
157 157 | FUNCTION rid { if (lookup(&functions, $2.str) == NULL) | FUNCTION rid { if (lookup(&functions, $2.str) == NULL)
158 158 yyerror("Undefined function."); yyerror("Undefined function.");
159 159 $$.ty = gCode; $$.ty = gCode;
 
... ... expr: intexpr
171 171 | expr TIMES expr { $$.ty = binop($1.ty, $3.ty); } | expr TIMES expr { $$.ty = binop($1.ty, $3.ty); }
172 172 | expr DIV expr { $$.ty = binop($1.ty, $3.ty); } | expr DIV expr { $$.ty = binop($1.ty, $3.ty); }
173 173 | expr MINUS expr { $$.ty = binop($1.ty, $3.ty); } | expr MINUS expr { $$.ty = binop($1.ty, $3.ty); }
174 | expr PLUS expr { if ($1.ty == gString && $3.ty == gString)
174 | expr PLUS expr {
175 if ($1.ty == gString && $3.ty == gString)
175 176 $$.ty = gString; $$.ty = gString;
176 177 else else
177 178 $$.ty = binop($1.ty, $3.ty); } $$.ty = binop($1.ty, $3.ty); }
 
... ... exprlist: /* empty */ { $$.pl = newparamlist(); }
218 219
219 220
220 221 stringexpr: STRINGLIT { $$.ty = gString; } stringexpr: STRINGLIT { $$.ty = gString; }
221 | stringexpr PLUS stringexpr { $$.ty = gString; }
222 222 ; ;
223 223
224 224 realexpr: REALLIT { $$.ty = gReal; } realexpr: REALLIT { $$.ty = gReal; }
 
... ... codeblock: /* empty */
282 282 statement: NEWLINE statement: NEWLINE
283 283 | CALL funccall | CALL funccall
284 284 | IF expr THEN codeblock elsifseq elseseq ENDIF { canconvert($2.ty, gBoolean); } | IF expr THEN codeblock elsifseq elseseq ENDIF { canconvert($2.ty, gBoolean); }
285 | SET rid EQUALS expr { canconvert($4.ty, getVariable($2.str)->ty); }
285 | SET rid EQUALS expr NEWLINE { canconvert($4.ty, getVariable($2.str)->ty); }
286 286 | SET rid LBRACKET expr RBRACKET EQUALS expr { | SET rid LBRACKET expr RBRACKET EQUALS expr {
287 287 canconvert($4.ty, gInteger); canconvert($4.ty, gInteger);
288 288 canconvert($7.ty, getVariable($2.str)->ty); } canconvert($7.ty, getVariable($2.str)->ty); }
File src/misc.c changed (mode: 100644) (index c644e0a..7247d84)
... ... int canconvert(const struct typenode *ufrom, const struct typenode *uto)
219 219 { {
220 220 const struct typenode *from = ufrom, *to = uto; const struct typenode *from = ufrom, *to = uto;
221 221 char ebuf[1024]; char ebuf[1024];
222 #if 0
223 if (lineno > 2400 && lineno < 2500) {
224 yydebug = 1;
225 fprintf(stderr, "LINE: %d\n", lineno);
226 }
227 else
228 yydebug = 0;
229 #endif
222 230 if (from == NULL || to == NULL) return 0; if (from == NULL || to == NULL) return 0;
223 231 if (isDerivedFrom(from, to)) if (isDerivedFrom(from, to))
224 232 return 1; return 1;
 
... ... int canconvert(const struct typenode *ufrom, const struct typenode *uto)
230 238 if ((from == gInteger || from == gReal) && if ((from == gInteger || from == gReal) &&
231 239 (to == gInteger || to == gReal)) (to == gInteger || to == gReal))
232 240 return 1; return 1;
241 /* Blizzard bug: allows downcasting erroneously */
242 /* TODO: get Blizzard to fix this in Blizzard.j and the language */
243 if (from == to)
244 return 1;
233 245 sprintf(ebuf, "Cannot convert %s to %s", ufrom->typename, uto->typename); sprintf(ebuf, "Cannot convert %s to %s", ufrom->typename, uto->typename);
234 246 yyerror(ebuf); yyerror(ebuf);
235 247 } }
File src/misc.h changed (mode: 100644) (index 9c7aab3..71f1959)
... ... void checkParameters(const struct paramlist *func, const struct paramlist *inp);
65 65
66 66 extern int lineno; extern int lineno;
67 67 extern char *yytext; extern char *yytext;
68 extern int yydebug;
68 69 extern struct hashtable functions, globals, locals, params, types, *curtab; extern struct hashtable functions, globals, locals, params, types, *curtab;
69 70 extern struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull; extern struct typenode *gInteger, *gReal, *gBoolean, *gString, *gCode, *gHandle, *gNothing, *gNull;
70 71 extern struct typenode *retval; extern struct typenode *retval;
File src/token.l changed (mode: 100644) (index 7edce10..18ab9f1)
... ... UNITTYPEINT ['][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][']
81 81 "]" return RBRACKET; "]" return RBRACKET;
82 82 "<" return LESS; "<" return LESS;
83 83 ">" return GREATER; ">" return GREATER;
84 "==" return EQCOMP;
84 85 "<=" return LEQ; "<=" return LEQ;
85 86 ">=" return GEQ; ">=" return GEQ;
86 "==" return EQCOMP;
87 87 "!=" return NEQ; "!=" return NEQ;
88 88
89 89 {ID} return ID; {ID} return ID;
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