Rangi
3c5e1caa7c
Disallow "." as a local label
...
Fixes #760
2021-02-25 04:40:42 +01:00
Rangi
d4028fff10
Prevent ELIF or ELSE after an ELSE
...
Fixes #749
2021-02-25 04:39:49 +01:00
ISSOtm
bee62076c6
Allow ENDC at EOF without a newline
2021-02-20 00:51:33 +01: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
fc2bf3d11d
Prefer sizeof($$) to MAXSTRLEN + 1
...
This makes `strsubUTF8` similar to `strrpl` and `strfmt`
2021-02-14 16:16:52 +01:00
Rangi
ebb5aab6db
Correct some comments
...
nPCOffset no longer exists, and the lexer only
returns T_NEWLINE for EOF in raw mode.
2021-02-14 16:16:52 +01:00
ISSOtm
88e1cc7302
Make EOF token name consistent across Bison versions
...
The "end of file" name apparently only became a default recently
2021-02-11 13:04:43 +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
ISSOtm
70bbb098d3
Remove stale keywords
...
They were removed from the grammar, but not the lexer
2021-01-23 00:05:56 +01:00
ISSOtm
1926065377
Enable Bison warnings
...
-Wall should be old enough.
Also use %empty instead of comments
2021-01-23 00:05:56 +01:00
Rangi
e3d355d976
Attempt to recover from syntax errors with bison
...
Fixes #595
2021-01-22 15:54:24 +01:00
ISSOtm
a679e02246
Get rid of asm.h and localasm.h
...
No need to make them global
2021-01-22 13:34:16 +01:00
ISSOtm
fa0fa4d5ac
Significantly overhaul OPT code
...
Simplify the mess that was option setting (2 redundant variables !?)
Move options to a separate file
Have "modules" own their options, and OPT only access them (less redundancy)
Simplify code, respect naming conventions better
2021-01-22 10:41:09 +01:00
ISSOtm
1487eebe79
Remove time counter
...
Nobody uses that, and it requires running extra code for each line
2021-01-22 08:51:57 +01:00
Rangi
f28b4abafc
Fix a potential buffer overflow in strrpl
...
This caused an error using clang with -O3 -flto
2021-01-20 10:21:53 +01:00
Rangi
fb39c3a70e
Consistently refer to "directives", not "pseudo-ops"
...
Some docs and warnings already referred to SECTION and
db/dw/dl "directives", but others used "pseudo-ops".
2021-01-19 15:03:22 +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
77279984a5
Implement STRRPL
...
Fixes #660
STRRPL(str, "", new) does nothing
(warn about it with -Wempty-strrpl)
2021-01-04 00:20:35 +01:00
ISSOtm
bd244e6865
Remove deprecated features
...
Trimming off the fat!
- GLOBAL and XDEF keywords
- Colon-less global labels
- *-comments
2021-01-02 02:42:44 +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
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
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
ISSOtm
5aabb915ec
Allow STRCAT to take any number of args
...
Fixes bullet point 1 of #625
2020-12-12 23:46:32 +01:00
ISSOtm
f5b0eae9cd
Remove custom action code when equivalent to default
...
Enables Bison to better reason about it, and should improve performance
2020-12-12 12:22:36 +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
58739b0bf2
Implement STRRIN, like STRIN but searching from the right
2020-12-10 15:32:17 +01:00
ISSOtm
3e4c2fe712
Avoid error with old Bison versions
...
`api.token.raw` is only defined starting with Bison 3.5
Since it's not essential, define it on the command-line iff the Bison
version is sufficient.
2020-12-10 15:13:45 +01:00
ISSOtm
9b6f01047c
Enable raw token types
...
Removes one layer of indirection for the parser, and helps remove all literals from the grammar
The latter preparing the next change
2020-12-09 21:22:05 +01:00
ISSOtm
eac365aef0
Allow argument to rb, rw and rl to be optional
...
Fixes #617
2020-12-09 09:31:47 +01:00
ISSOtm
4f842a1248
Create specialized symbol finder functions
...
The old "find symbol with auto scope" function is now three:
- One finds the exact name passed to it, skipping any checks
This is useful e.g. if such checks were already performed.
- One checks that the name is not scoped, and calls the first.
This is useful for names that cannot be scoped, such as checking for EQUS.
Doing this instead of the third should improve performance somehwat, since
this specific case is hit by the lexer each time an identifier is read.
- The last one checks if the name should be expanded (`.loc` → `Glob.loc`),
and that the local part is not scoped. This is essentially the old function.
2020-11-21 01:06:17 +01:00
Jakub Kądziołka
4e1d79081c
Improve error message for negative shift arguments
2020-10-13 15:42:16 +02:00
Jakub Kądziołka
045a9e8b93
Report only one error when invalid shift has argument
...
Not to mention that incrementing a variable in a loop is kinda dumb.
2020-10-12 22:54:20 +02:00
Jakub Kądziołka
6767d11c23
utf8decoder: Use byte-sized byte argument
...
This prevents passing a negative value out of a signed char by accident.
Also renders some casts in the code superfluous.
2020-10-12 01:22:09 +02:00
ISSOtm
2dd9015dc6
Remove two stale variables from parser.y
...
They were made useless with the lexer rewrite
2020-10-12 00:52:12 +02:00
ISSOtm
01637768cf
Rename asmy to more explicit parser
...
This should make the purpose of that file clearer to newcomers
2020-10-11 21:03:41 +02:00