Merge pull request #2209 from vrubleg/linecont

ca65: `.LINECONT` as a part of `.FEATURE`
This commit is contained in:
Bob Andrews 2023-12-08 02:10:45 +01:00 committed by GitHub
commit 519a52d92c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 23 deletions

View File

@ -2867,6 +2867,26 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
overridden. When using this feature, you may also get into trouble if overridden. When using this feature, you may also get into trouble if
later versions of the assembler define new keywords starting with a dot. later versions of the assembler define new keywords starting with a dot.
<tag><tt>line_continuations</tt><label id="line_continuations"></tag>
Switch on or off line continuations using the backslash character
before a newline. The option is off by default.
Note: Line continuations do not work in a comment. A backslash at the
end of a comment is treated as part of the comment and does not trigger
line continuation.
Example:
<tscreen><verb>
.feature line_continuations + ; Allow line continuations
lda \
#$20 ; This is legal now
</verb></tscreen>
For backward compatibility reasons, the <tt>.LINECONT +</tt> control command
is also supported and enables the same feature.
<tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag> <tag><tt>long_jsr_jmp_rts</tt><label id="long_jsr_jmp_rts"></tag>
Affects 65816 mode only. Affects 65816 mode only.
@ -3371,26 +3391,6 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
the feature in more detail. the feature in more detail.
<sect1><tt>.LINECONT</tt><label id=".LINECONT"><p>
Switch on or off line continuations using the backslash character
before a newline. The option is off by default.
Note: Line continuations do not work in a comment. A backslash at the
end of a comment is treated as part of the comment and does not trigger
line continuation.
The command can be followed by a '+' or '-' character to switch the
option on or off respectively.
Example:
<tscreen><verb>
.linecont + ; Allow line continuations
lda \
#$20 ; This is legal now
</verb></tscreen>
<sect1><tt>.LIST</tt><label id=".LIST"><p> <sect1><tt>.LIST</tt><label id=".LIST"><p>
Enable output to the listing. The command can be followed by a boolean Enable output to the listing. The command can be followed by a boolean
@ -4489,9 +4489,9 @@ different:
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> may not <item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> may not
span more than a line. You may use line continuation (see <tt><ref span more than a line. You may use line continuation (see <tt><ref
id=".LINECONT" name=".LINECONT"></tt>) to spread the definition over id="line_continuations" name="line_continuations"></tt>) to spread the
more than one line for increased readability, but the macro itself definition over more than one line for increased readability, but the
may not contain an end-of-line token. macro itself may not contain an end-of-line token.
<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> share <item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> share
the name space with classic macros, but they are detected and replaced the name space with classic macros, but they are detected and replaced

View File

@ -67,6 +67,7 @@ static const char* const FeatureKeys[FEAT_COUNT] = {
"bracket_as_indirect", "bracket_as_indirect",
"string_escapes", "string_escapes",
"long_jsr_jmp_rts", "long_jsr_jmp_rts",
"line_continuations",
}; };
@ -121,6 +122,7 @@ void SetFeature (feature_t Feature, unsigned char On)
case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = On; break; case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = On; break;
case FEAT_STRING_ESCAPES: StringEscapes = On; break; case FEAT_STRING_ESCAPES: StringEscapes = On; break;
case FEAT_LONG_JSR_JMP_RTS: LongJsrJmpRts = On; break; case FEAT_LONG_JSR_JMP_RTS: LongJsrJmpRts = On; break;
case FEAT_LINE_CONTINUATIONS: LineCont = On; break;
default: break; default: break;
} }
} }

View File

@ -69,6 +69,7 @@ typedef enum {
FEAT_BRACKET_AS_INDIRECT, FEAT_BRACKET_AS_INDIRECT,
FEAT_STRING_ESCAPES, FEAT_STRING_ESCAPES,
FEAT_LONG_JSR_JMP_RTS, FEAT_LONG_JSR_JMP_RTS,
FEAT_LINE_CONTINUATIONS,
/* Special value: Number of features available */ /* Special value: Number of features available */
FEAT_COUNT FEAT_COUNT