Rangi
a09f2d4115
Test an indented macro label
2021-02-23 14:48:27 -05:00
Eldred Habert
dafef5a953
Remove column 1 restriction for labels with colons ( #635 )
...
Partial fix for #457
2021-02-23 14:42:24 -05:00
dannye
929e2a4490
rgbasm: Report conflicting file/line number for duplicate sections
2021-02-23 20:08:59 +01:00
dannye
cc1129093d
Add duplicate-section test
2021-02-23 20:08:59 +01:00
ISSOtm
72911ada2d
Prevent non-numeric symbol from overriding refs
...
Fixes #751
2021-02-22 13:00:25 +01:00
Rangi
5fd636ac4b
Implement floored / and divisor-sign % operators ( #745 )
...
Fixes #703
2021-02-21 16:14:44 -05:00
Rangi
a6d844a9a5
Add more test cases for IF, REPT, and MACRO ( #748 )
2021-02-19 19:34:21 -05:00
Rangi
5c1ae4ce22
Shorter quine test cases
2021-02-17 11:51:21 -05:00
Rangi
7dd34f1572
Format INT32_MIN as '-2147483648', not '--2147483648'
2021-02-17 09:48:40 -05:00
Rangi
748e7dd4c7
Fix calculation of 2**30
...
In exponent(), 'base *= base;' should not run
when base is 65536, since it overflows an int32_t.
This also optimizes exponent() based on
gcc and clang -O3 test cases in godbolt.org.
2021-02-17 09:25:02 -05:00
Rangi
d049ffc0f0
Handle string literals within macro arguments ( #685 )
...
Fixes #683 and #691
The lexer's raw mode for reading macro args already attempted
to handle semicolons inside string literals, versus outside ones
which start comments. This change reuses the same function for
reading string literals in normal and raw modes, also handling:
- Commas in strings versus between macro args
- Character escapes
- {Interpolations} and \1-\9 args inside vs. outside strings
- Multi-line string literals
Macro args now allow escaping '\', '"', and '\\'.
A consistent model for expanding macro args and interpolations,
within macro args, string literals, and normal context:
- "{S}" should always equal the contents of S
- "\1" should always act like quoting the value of \1
2021-02-16 22:44:25 -05:00
Rangi
8c0275480c
Allow ds to take multiple values to repeat for a count ( #725 )
...
Fixes #722
2021-02-16 22:01:23 -05:00
Rangi
76d6ef8695
Implement LOAD UNION and LOAD FRAGMENT
...
Fix #632
2021-02-17 03:42:06 +01:00
Rangi
ee20d9010e
Make @ relative to the start of a ds even at link time
...
Fix #737
2021-02-16 22:47:07 +01:00
Rangi
cb61da8842
-Wmacro-shift warns about shifting macro arguments too far ( #741 )
...
Fixes #735
2021-02-16 16:31:01 -05:00
Rangi
dddff0f450
Cannot start a new section that's already on the stack
...
This is only relevant for FRAGMENT or UNION sections, since
normal ones would fail with "Section already defined previously".
Fixes #730
2021-02-16 21:51:48 +01:00
Rangi
8f20620c16
Allow shifting macro arguments by a negative amount
...
Fixes #733
2021-02-14 16:21:00 +01:00
Rangi
96bce05be2
Newlines in multi-line strings update the line number
...
This affects error and warning messages, and dbgPrint
2021-02-14 16:16:52 +01:00
ISSOtm
b3c0db218d
Remove "EOF-newline" lexer hack
...
In preparation for an upcoming change
Makes for nicer error messages, complaining about EOF instead of newlines
The hack had to be kept for the lexer raw mode to avoid a bug;
see the relevant code comment for more info.
2021-02-11 12:48:37 +01:00
ISSOtm
76446e6d00
Change behavior of merging FRAGMENTs to constrain each fragment individually
...
Additionally, remove the deprecated merging of non-fragment SECTIONs
2021-02-10 10:19:16 +01:00
Rangi
e3d355d976
Attempt to recover from syntax errors with bison
...
Fixes #595
2021-01-22 15:54:24 +01:00
Rangi
93d83e17dc
Don't override bison's internal 'yytnamerr' function
...
This is not used in all bison versions, which causes a
"defined but not used" warning for the 'rgbasm_yytnamerr'
replacement, treated as an error by 'make develop'.
2021-01-15 11:51:31 +01:00
Rangi
df16e64fc6
Handle MACRO and REPT/FOR bodies differently
...
Fixes #697
2021-01-15 02:16:37 +01:00
Rangi
eb4952c188
Use more verbose syntax error messages
...
Fixes #385
2021-01-14 18:36:10 +01:00
ISSOtm
57b734a7df
Reinstate RL into the _RS family
...
Removal of colon-less labels lifted the grammar ambiguity that
prevented `RL` from being usable as a variable declarator.
Thus, reinstate its functionality.
2021-01-11 01:38:03 +01:00
Rangi
cab9cb06a3
Store IF depth relative to each fstack context
...
This disallows starting/ending an IF inside an
INCLUDEd file or a macro expansion
2021-01-09 20:12:14 +01:00
Rangi
62bea23c49
Implement BREAK to exit REPT and FOR loops
...
Fixes #684
2021-01-08 21:13:23 +01:00
Rangi
7ce5cf1595
Convert floating to fixed point by rounding, not truncation
...
Fixes #678
2021-01-04 21:23:43 +01:00
Rangi
77279984a5
Implement STRRPL
...
Fixes #660
STRRPL(str, "", new) does nothing
(warn about it with -Wempty-strrpl)
2021-01-04 00:20:35 +01:00
Rangi
a70ecba06f
Implement PRINT and PRINTLN ( #672 )
...
Fixes #669
Closes #368
Closes #624
Deprecate PRINTT, PRINTV, PRINTI, and PRINTF
Default STRFMT("%f") to 5 fractional digits like "{f:}"
Any use of string formatting will share this default
2021-01-02 02:37:32 +01:00
Rangi
9d2d5cfcfe
Implement REDEF to allow redefining EQUS string equates
...
Fixes #677
2021-01-02 01:49:00 +01:00
Rangi
895ec5564d
Update mathematical functions ( #675 )
...
Document the existing `ROUND`, `CEIL`, and `FLOOR` functions
Also update the trig function docs for searchability
Implement `POW` and `LOG`
Addresses part of #675
Implement ** for integer exponents
** has higher precedence than -, like Python, so -3**4 == -(3**4) == 81
2021-01-02 01:39:20 +01:00
Rangi
7bb6f71f0b
Change FOREACH to FOR ( #680 )
2021-01-02 00:46:26 +01:00
Rangi
10e3f1a02b
Deprecate built-in _PI
...
Fixes #670
2021-01-01 19:18:17 +01:00
Rangi
c0ce1da4c3
Implement STRFMT and more printf-like format specifiers for string interpolation ( #646 )
...
Fixes #570
Fixes #178
Use errors for inapplicable format spec flags instead of -Wstring-format
2020-12-29 22:53:15 +01:00
Rangi
6874f694e5
Implement FOREACH ( #658 )
...
This acts like `REPT` with a variable automatically
incremented across a range of values
Fixes #432
2020-12-29 21:30:42 +01:00
ISSOtm
7bc42d468b
Clean up temp test files even if interrupted
...
Avoids "tmp.*" piling up in /tmp
2020-12-26 14:38:04 +01:00
Rangi
255b8bf9ba
Implement """triple-quoted""" multi-line strings
...
Fixes #589
2020-12-19 12:34:32 +01:00
Rangi
063a22ddf9
LOAD blocks cannot create a ROM section
...
Fixes #576
2020-12-19 00:58:54 +01:00
Rangi
1d9cc01ae1
Macro arguments within a string literal are read into the string, not expanded
...
Fixes #643
2020-12-15 21:28:15 +01:00
Rangi
f31deb5010
Fix STRUPR and STRLWR after 5aabb915ec
...
Fixes #647
2020-12-15 20:18:45 +01:00
ISSOtm
8f2a894b88
Add anonymous labels
...
Fix #497
2020-12-14 10:14:40 +01:00
Rangi
0e40543757
Implement \# to expand to all unshifted macro arguments
...
Fixes #596
2020-12-14 00:12:36 +01:00
Rangi
ce58f6d6be
Allow {symbol} interpolation outside of strings
...
Fixes #629
Closes #631
2020-12-13 23:53:16 +01:00
ISSOtm
5aabb915ec
Allow STRCAT to take any number of args
...
Fixes bullet point 1 of #625
2020-12-12 23:46:32 +01:00
Rangi
165bd8cb71
Allow 'dw' and 'dl' to apply to characters of strings
...
Fixes #568
The old behavior of `dw "string"` can be replicated with `dw ("string")`; likewise for dl
2020-12-11 11:02:20 +01:00
Rangi
af530859f0
Allow underscores in numeric literals
...
Fixes #539
Changes \@'s output to start with "_u", not "_", so it will be valid within labels but not numerics
2020-12-10 15:34:21 +01:00
Rangi
58739b0bf2
Implement STRRIN, like STRIN but searching from the right
2020-12-10 15:32:17 +01:00
ISSOtm
bdfce25db0
Avoid running version test when git describe fails
...
Can happen when not enough history has been fetched, notably in our CI
2020-12-10 13:43:22 +01:00
ISSOtm
bf789dd7b3
Add automated test for version consistency
...
Automatically check that the version number constants
(__RGBDS_MAJOR__ etc.) match `rgbasm -V`
Should avoid the problem with 0.4.2's release...
2020-12-10 12:22:29 +01:00