Skip to content

Commit

Permalink
Merge pull request cc65#2209 from vrubleg/linecont
Browse files Browse the repository at this point in the history
ca65: `.LINECONT` as a part of `.FEATURE`
  • Loading branch information
mrdudz authored Dec 8, 2023
2 parents 66bfc31 + 850007c commit 519a52d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
46 changes: 23 additions & 23 deletions doc/ca65.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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>

Affects 65816 mode only.
Expand Down Expand Up @@ -3371,26 +3391,6 @@ See: <tt><ref id=".ASCIIZ" name=".ASCIIZ"></tt>,<tt><ref id=".CHARMAP" name=".CH
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>

Enable output to the listing. The command can be followed by a boolean
Expand Down Expand Up @@ -4489,9 +4489,9 @@ different:

<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
id=".LINECONT" name=".LINECONT"></tt>) to spread the definition over
more than one line for increased readability, but the macro itself
may not contain an end-of-line token.
id="line_continuations" name="line_continuations"></tt>) to spread the
definition over more than one line for increased readability, but the
macro itself may not contain an end-of-line token.

<item> Macros defined with <tt><ref id=".DEFINE" name=".DEFINE"></tt> share
the name space with classic macros, but they are detected and replaced
Expand Down
2 changes: 2 additions & 0 deletions src/ca65/feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static const char* const FeatureKeys[FEAT_COUNT] = {
"bracket_as_indirect",
"string_escapes",
"long_jsr_jmp_rts",
"line_continuations",
};


Expand Down Expand Up @@ -121,6 +122,7 @@ void SetFeature (feature_t Feature, unsigned char On)
case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = On; break;
case FEAT_STRING_ESCAPES: StringEscapes = On; break;
case FEAT_LONG_JSR_JMP_RTS: LongJsrJmpRts = On; break;
case FEAT_LINE_CONTINUATIONS: LineCont = On; break;
default: break;
}
}
1 change: 1 addition & 0 deletions src/ca65/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef enum {
FEAT_BRACKET_AS_INDIRECT,
FEAT_STRING_ESCAPES,
FEAT_LONG_JSR_JMP_RTS,
FEAT_LINE_CONTINUATIONS,

/* Special value: Number of features available */
FEAT_COUNT
Expand Down

0 comments on commit 519a52d

Please sign in to comment.