Rangi
f8af569680
Shorten license comments and consolidate an AUTHORS file ( #1217 )
2023-11-05 09:54:32 +01:00
Rangi
259ec58140
Implement ENDSECTION ( #1211 )
2023-11-04 23:41:17 +01:00
Rangi
01f1703dfb
Preserve \@ through INCLUDE
...
Fixes #1112
2022-12-11 18:56:03 +01:00
Rangi
a1107fc5cf
Refactor !!x to x != 0
...
Also limit comments and docs to single "!"s
2022-10-01 14:09:02 -04:00
Rangi
5ad8a8c958
Warn when a duplicate CLI argument overrides a previous one ( #1053 )
...
Fixes #1050
2022-09-25 10:04:30 +02:00
Rangi
b8385a50e3
Support -P/--preinclude to pre-INCLUDE a file ( #1043 )
...
Fixes #1041
Co-authored-by: ISSOtm <eldredhabert0@gmail.com >
2022-09-24 12:37:16 -04:00
Rangi
c01317e08d
Only increment the unique \@ ID when it is first used per context ( #1030 )
...
This avoids changes to generated `\@` labels just by adding or
removing macros or loops which do not actually use `\@`.
Fixes #1019
2022-08-31 17:45:21 -04:00
Rangi
a52a00a9ca
macro_UndefUniqueID uses 0 to mean \@ is undefined
2022-08-30 16:50:34 -04:00
Rangi
fa13611bbf
Make comments more consistent
...
- Changes most `/* comments */` to `// comments`
- Changes `/**` block comments consistently to `/*`
- Adds consistent license comments to all files
Also renames `T_POP_SET` to `T_Z80_SET`
2022-08-30 07:51:32 +02:00
Rangi
7a2ee26792
rgbasm -r sets the maximum recursion depth (#1026 )
...
Previously it set the minimum failure depth (off by one)
Fixes #978
2022-08-28 15:21:29 -04:00
ISSOtm
7dd8ba37f1
Allow changing recursion depth limit at runtime
2022-02-05 20:32:56 +01:00
Rangi
aac839f389
Remove dbgPrint and TRACE_LEXER support
...
I have not found `TRACE_LEXER` to be useful in debugging
actual lexer issues.
2021-11-22 23:49:59 +01:00
Rangi
b9fd85470e
Reword docs now that SET is deprecated ( #946 )
...
- '=' constants are "variables" (not "mutable constants")
- EQU constants are "numeric constants" (not "immutable constants")
- EQUS constants are "string constants" (not "string equates")
- DS declarations are "static allocations" (not "variables")
2021-11-22 17:08:29 -05:00
Rangi
3fdf01c0f5
Resolve some TODO comments
...
- `out_PushSection` should not set `currentSection` to NULL because
PUSHS, PUSHC, and PUSHO consistently keep the current section,
charmap, and options, even though the stack has been pushed.
- `Callback__FILE__` does not need to assert that `fileName` is not
empty because `__FILE__`'s value is quoted, and can safely be empty.
- `YY_FATAL_ERROR` and `YYLMAX` are not needed since the lexer is
not generated with flex.
2021-04-26 15:52:30 -04:00
ISSOtm
6d0a3c75e9
Get rid of Hungarian notation for good
...
Bye bye it was not nice knowing ya
2021-04-19 22:12:10 +02:00
Rangi
c0859e64f7
fstk_FindFile checks for sprintf failure
2021-04-13 09:31:05 -04:00
Rangi
49aac2961d
Warn about backwards FOR loops with -Wbackwards-for (-Wall)
...
Fixes #816
2021-03-31 10:00:21 -04:00
ISSOtm
4216f0a9b0
Init top-level fstack node line number
...
It still gets written to the object file, generating Valgrind warnings
about using uninitialized memory. To silence those errors, and make
output more reproducible, init the line no to a dummy (0) value.
2021-03-25 11:26:58 +01:00
ISSOtm
aaa4e17454
Add verbose messages for early exit from -MG
...
Should help debugging Make invocations
2021-03-14 18:28:05 +01:00
ISSOtm
60019cf476
Fix a bunch of Clang warnings
...
As reported by #789
Should avoid relying on 32-bit int (for implicit conversions)
and account for more extreme uses of RGBDS.
2021-03-10 10:56:57 +01:00
Rangi
d4028fff10
Prevent ELIF or ELSE after an ELSE
...
Fixes #749
2021-02-25 04:39:49 +01:00
ISSOtm
cd072d5e6a
Add assertion check for potential UAF trigger
...
It actually currently triggers if an INCLUDE directive is given at EOF,
but #742 will fix that.
2021-02-19 16:53:30 +01:00
ISSOtm
6ef3ee1391
Give void* ptr to %p formatter
...
Silences a format type mismatch warning
2021-02-19 16:53:26 +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
effc58241d
Rework defining variables on command-line
...
Avoids allocating memory
Detects CLI errors even when failing to open file
Reports symbols as defined on command-line instead of input line 0 (!?)
2021-01-22 11:03:43 +01:00
Rangi
df16e64fc6
Handle MACRO and REPT/FOR bodies differently
...
Fixes #697
2021-01-15 02:16:37 +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
7bb6f71f0b
Change FOREACH to FOR ( #680 )
2021-01-02 00:46:26 +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
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
ISSOtm
c24694233f
Fix incomplete duplication of REPT nodes
...
"Initialization, sizeof, and the assignment operator ignore the flexible array member."
Oops!
2020-10-04 04:46:01 +02:00
ISSOtm
5a65188ca9
Implement compact file stacks in object files
...
Gets rid of `open_memstream`, enabling Windows compatibility again
Also fixes #491 as a nice bonus!
2020-10-04 04:46:01 +02:00
ISSOtm
96cb5e10ed
Fix range-dependent dead code in recursion depth check
2020-10-04 04:46:01 +02:00
ISSOtm
71a0a42cfb
Fix C2x use of static_assert
2020-10-04 04:46:01 +02:00
ISSOtm
e33c2ad6a2
Fix INCLUDE ignoring -MG
2020-10-04 04:46:00 +02:00
ISSOtm
ece6853e0f
Implement opt b and opt g
2020-10-04 04:46:00 +02:00
ISSOtm
b7b03ee451
Fix "REPT 0" not being a no-op
2020-10-04 04:45:59 +02:00
ISSOtm
d641972cde
Fix macro args not being restored when exiting macros
2020-10-04 04:45:59 +02:00
ISSOtm
4d1333e124
Fix incorrect error reporting of INCLUDEd files
2020-10-04 04:45:59 +02:00
ISSOtm
ae77893021
Fix file name reporting
...
As noted in the function's code, this is very error-prone, but
will do the job; this needs rewriting due to #491 anyways, so, temporary.
2020-10-04 04:45:59 +02:00
ISSOtm
fd02ffb7bd
Implement __FILE__ symbol
...
Also clean up built-in symbol creation
This is not great, but currently okay.
Should be fixed later, like the rest...
2020-10-04 04:45:58 +02:00
ISSOtm
d9ecaabac1
Add debug tracing code to lexer
...
Hidden behind a #define, like YYDEBUG
2020-10-04 04:39:26 +02:00
ISSOtm
cd747d8175
Fix many lexer bugs
...
More to come...
2020-10-04 04:39:25 +02:00
ISSOtm
e11f25024e
Add test for built-in file symbol
...
It's currently defined in fstack.c, making it more prone to accidental
dropping. Let's not repeat the 0.3.9 scenario...
2020-10-04 04:38:53 +02:00
ISSOtm
4c9a929a14
Implement almost all functionality
...
Add keywords and identifiers
Add comments
Add number literals
Add strings
Add a lot of new tokens
Add (and clean up) IF etc.
Improve reporting of unexpected chars / garbage bytes
Fix bug with and improved error messages when failing to open file
Add verbose-level messages about how files are opened
Enforce that files finish with a newline
Fix chars returned not being cast to unsigned char (may conflict w/ EOF)
Return null path when no file is open, rather than crash
Unify and improve error printing slightly
Known to be missing: macro expansion, REPT blocks, EQUS expansions
2020-10-04 04:38:50 +02:00
ISSOtm
71f8871702
Implement more functionality
...
Macro arg detection, first emitted tokens, primitive (bad) column counting
2020-10-04 04:37:58 +02:00
ISSOtm
6dc4ce6599
Implement infrastructure around new lexer
...
The lexer itself is very much incomplete, but this is intended to be a
safe point to revert to should further implementation go south.
2020-10-04 04:37:58 +02:00
ISSOtm
a1286e6f0e
Make newlines explicit in error messages
...
In preparation for a change a PR is about to make
2020-09-27 10:54:06 +02:00