-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement [[ inline fragments ]] #716
base: master
Are you sure you want to change the base?
Conversation
|
7db4cc1
to
18205c7
Compare
This is a shame; single lines of code (such as a simple |
Mildly agree, but I don't see a non-hacky way for |
faeb5d5
to
bc6bd22
Compare
The proper fix is to remove the lexer hack of forcing a newline at EOF, and allowing the last |
Currently the Edit: The newline issue has already been fixed in master, so this PR can support single-line fragments now. :) |
ddbb53f
to
f5b93f4
Compare
More generally, after seeing some of the code written using this, I'm not fond of the syntax. That's my opinion, I'd like to hear others'. |
"Column 1" doesn't have to be a thing for labels: #635 addresses that, though it still requires constants to be defined in column 1 and macros to be invoked past column 1. |
#635 has problems, and won't be merged for a while due to the required deprecations. |
Weren't the problems due to allowing non-local labels without colons? All of these cases should be unambiguous:
|
This is not what it currently does; though this would be better continued there. |
5f07aca
to
be3186f
Compare
Regarding the syntax, my examples in the test cases are more to just demonstrate many technically valid things using it. I think ax6's example is more representative of usage in practice (just imagine double-brackets there), and even though it has nested inline fragments, I would find it more readable than the equivalent with named labels. You do have to use good judgment to not nest the fragments with many levels of indentation just because it's technically possible. |
be3186f
to
2da422d
Compare
@aaaaaa123456789 @mid-kid @pinobatch @AntonioND @NieDzejkob @JL2210 What do you think of the syntax for these? (Please see discussion above and in #500.) |
e760ae5
to
33ddac8
Compare
7a5fdd5
to
f384216
Compare
035e41b
to
5d87006
Compare
5d87006
to
6cc05eb
Compare
Oh hey, asmotor has had these since 2019:
(It doesn't allow The implementation is similar to this PR: when it sees an opening brace, push the section stack, create a new section (albeit with a new section not a fragment of the current one) and a label, parse until the closing brace, pop the stack, and evaluate as the new label. That makes me somewhat more confident in it (not that asmotor has a large user base to stress-test it, but they at least aren't handling some error case I missed). |
6cc05eb
to
4fac8d0
Compare
Fixes #500
Anywhere you would normally use an address, such as
dw Label
orld hl, Label
orcall Label
, you can use an[[ inline fragment ]]
instead. Each inline fragment becomes its ownSECTION FRAGMENT
to be combined with the current section.