Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Added modulo operator. | 70b4c5117a0b84cddd0c35e07a47e3b2aaf847b8 | lep | 2018-08-09 19:46:14 |
Replace strncat with str_append. | ad968e040f315ed3cf6580e46587342897839529 | lep | 2018-03-21 13:53:11 |
Do not report arrays as uninitialized when the index is missing. | 72e93bd234743a438fb0a5c105514bf732c22b89 | lep | 2017-12-20 14:59:10 |
Better error messages. | ad8342582ac3617280f471d889b1766be272858b | lep | 2017-11-15 17:52:08 |
Handle wrong shadowing. | 0500a60ef11f39c4f33044e26c29798f6d8445b5 | lep | 2017-02-19 14:37:21 |
Added checks for natives which behave bad in a globals block. | 3e6ac270dda9ad695723d3bc2aac4d69a2fdf87a | lep | 2017-02-19 10:57:33 |
Update readme.md | 2c9177dd5482ed8c4c1464a4ade37c301205fe6b | lep | 2017-02-01 17:42:49 |
Public git release. | 2da78f3665ac4f53f5833c6a48ebbeaabea0cd49 | lep | 2017-02-01 16:42:21 |
Better ifdef-handling for aligned malloc. | d95ebafa7204e49d84a9fed8cdeb01713dd0bc82 | lep | 2017-02-01 16:41:07 |
Makefile changes. | 0458bb26764aad1caec71ccf721e84a28c699ee0 | lep | 2017-02-01 15:48:25 |
Can now compile on freebsd and linux from one branch. | 0772c4bd17dcfc389ca0e887b4bbceda8e46fa8e | lep | 2017-01-07 21:05:10 |
More descriptive check for assignment. | 474462b44fe20e958e8c6a3b51ba2da9c4a46451 | lep | 2016-11-24 16:47:15 |
Actually add all the sources to the release zipball | 151ae88aac4c3ac8aae432a4a240239f652fa8f4 | lep | 2016-11-10 15:30:38 |
Don't treat ``.'' as a valid real value. | 72e5087e22af66de0765c6d4f9ceae154725e2c2 | lep | 2016-10-24 14:55:02 |
Also split on \r in flag parser. | 519d685ab24864716e3a1ecfd797790a327868ca | lep | 2016-08-28 12:41:08 |
Improved errors for function-calls. | 5a50178a03c5aa3d153e8699070942327fde0b7b | lep | 2016-08-27 18:44:01 |
A very strange error with newlines and comments. | d822cacbd889fe723102102c8a09d578d90f013e | lep | 2016-08-21 09:15:00 |
Added +nosyntaxerror and +nosemanticerror | e755e12b3cab1d5069574e34d22633dd420bb230 | lep | 2016-05-07 13:42:57 |
MinGW fixes. | f579fad932039f1bca43e7612154f5b7dc4aea4f | lep | 2016-03-13 19:29:36 |
Added +shadow description to -h | 6a62b1ecf773175992a2a430a178fffb5532e467 | lep | 2016-03-13 19:35:20 |
File | Lines added | Lines deleted |
---|---|---|
grammar.y | 6 | 1 |
misc.c | 20 | 0 |
tests/should-check/modulo.j | 4 | 0 |
tests/should-fail/modulo-real.j | 6 | 0 |
token.l | 1 | 0 |
File grammar.y changed (mode: 100644) (index 939157c..64cf815) | |||
60 | 60 | %token EQUALS | %token EQUALS |
61 | 61 | %token TIMES | %token TIMES |
62 | 62 | %token DIV | %token DIV |
63 | %token MOD | ||
63 | 64 | %token PLUS | %token PLUS |
64 | 65 | %token MINUS | %token MINUS |
65 | 66 | %token LPAREN | %token LPAREN |
84 | 85 | %left LESS GREATER EQCOMP NEQ LEQ GEQ | %left LESS GREATER EQCOMP NEQ LEQ GEQ |
85 | 86 | %left NOT | %left NOT |
86 | 87 | %left MINUS PLUS | %left MINUS PLUS |
87 | %left TIMES DIV | ||
88 | %left TIMES DIV MOD | ||
88 | 89 | ||
89 | 90 | %% | %% |
90 | 91 | ||
... | ... | expr: intexpr { $$.ty = gInteger; } | |
202 | 203 | | NOT expr { canconvert($2.ty, gBoolean, 0); $$.ty = gBoolean; } | | NOT expr { canconvert($2.ty, gBoolean, 0); $$.ty = gBoolean; } |
203 | 204 | | expr TIMES expr { $$.ty = binop($1.ty, $3.ty); } | | expr TIMES expr { $$.ty = binop($1.ty, $3.ty); } |
204 | 205 | | expr DIV expr { $$.ty = binop($1.ty, $3.ty); } | | expr DIV expr { $$.ty = binop($1.ty, $3.ty); } |
206 | | expr MOD expr { | ||
207 | checkmodulo($1.ty, $3.ty); | ||
208 | $$.ty = gInteger; | ||
209 | } | ||
205 | 210 | | expr MINUS expr { $$.ty = binop($1.ty, $3.ty); } | | expr MINUS expr { $$.ty = binop($1.ty, $3.ty); } |
206 | 211 | | expr PLUS expr { | | expr PLUS expr { |
207 | 212 | if ($1.ty == gString && $3.ty == gString) | if ($1.ty == gString && $3.ty == gString) |
File misc.c changed (mode: 100644) (index 64ca79a..1fcb71f) | |||
... | ... | void checkcomparison(const struct typenode *a, const struct typenode *b) | |
487 | 487 | yyerrorex(semanticerror, "Comparing null is not allowed"); | yyerrorex(semanticerror, "Comparing null is not allowed"); |
488 | 488 | } | } |
489 | 489 | ||
490 | void checkmodulo(const struct typenode *a, const struct typenode *b) | ||
491 | { | ||
492 | const struct typenode *pa, *pb; | ||
493 | pa = getPrimitiveAncestor(a); | ||
494 | pb = getPrimitiveAncestor(b); | ||
495 | |||
496 | bool fst = typeeq(pa, gInteger); | ||
497 | bool snd = typeeq(pb, gInteger); | ||
498 | |||
499 | if(! fst && ! snd){ | ||
500 | yyerrorex(semanticerror, "Both arguments of the modulo-operator must be integers"); | ||
501 | }else if(! fst){ | ||
502 | yyerrorex(semanticerror, "First argument of the modulo-operator must be an integer"); | ||
503 | }else if(! snd){ | ||
504 | yyerrorex(semanticerror, "Second argument of the modulo-operator must be an integer"); | ||
505 | } | ||
506 | |||
507 | |||
508 | } | ||
509 | |||
490 | 510 | void checkeqtest(const struct typenode *a, const struct typenode *b) | void checkeqtest(const struct typenode *a, const struct typenode *b) |
491 | 511 | { | { |
492 | 512 | const struct typenode *pa, *pb; | const struct typenode *pa, *pb; |
File tests/should-check/modulo.j added (mode: 100644) (index 0000000..b528d2a) | |||
1 | |||
2 | globals | ||
3 | integer x = 123 % 7 | ||
4 | endglobals |
File tests/should-fail/modulo-real.j added (mode: 100644) (index 0000000..8ece47b) | |||
1 | |||
2 | globals | ||
3 | real x = 123.5 % 21 | ||
4 | real y = 123 % 21.5 | ||
5 | real z = 123.5 % 21.5 | ||
6 | endglobals |
File token.l changed (mode: 100644) (index a4763c1..02dd534) | |||
... | ... | TABS [\x01-\x09\x0B\x0C\x0E-\x1F] | |
143 | 143 | "=" return EQUALS; | "=" return EQUALS; |
144 | 144 | "*" return TIMES; | "*" return TIMES; |
145 | 145 | "/" return DIV; | "/" return DIV; |
146 | "%" return MOD; | ||
146 | 147 | "+" return PLUS; | "+" return PLUS; |
147 | 148 | "-" return MINUS; | "-" return MINUS; |
148 | 149 | "(" return LPAREN; | "(" return LPAREN; |