The EOL is defined as either '\r\n', or '\r', or '\n'.
A '\r' on its own is converted into a '\n' to correctly handle
raw input, typically due to 'copy-n-paste' of text files.
+ But a '\r\n' sequence is left ASIS for string handling
*/
#define GetChar(c) \
{ \
continue;
}
GetChar(c);
- if (c == '\n' || c == '\r' )
+ if (c == '\n')
switch (state) {
case IN_COMMENT:
state=IN_WHITE; /* end comment */
+ case IN_QUOTE:
+ if (quote != '"')
+ break; /* in double quotes only */
case IN_WHITE:
case IN_TOKEN:
- continue; /* line continuation (outside quotes and comment) */
+ continue; /* line continuation - remove line feed */
}
switch (state) {
case IN_WHITE:
l=30, c=1, stat=0, len=64, token="° ' ² ³ ` ´"
l=31, c=1, stat=0, len=64, token="µ ¶ ⨀ ⨁ ⨂"
l=32, c=1, stat=0, len=64, token="测试用的汉字"
-l=34, c=1, stat=0, len=64, token="Lines____Continuation"
-l=37, c=1, stat=0, len=64, token="quoted_newlines__
+l=34, c=1, stat=0, len=64, token="Line____Continuation"
+l=37, c=1, stat=0, len=64, token="Double_Quoted_Line____Continuation"
+l=40, c=1, stat=0, len=64, token="Single_Quoted_Line__\
+__Continuation_NOT!"
+l=43, c=1, stat=0, len=64, token="double_quoted_newlines__
__are_part_of_token"
-l=40, c=1, stat=0, len=64, token="Last Token before EOF"
+l=46, c=1, stat=0, len=64, token="single_quoted_newlines__
+__are_part_of_token"
+l=49, c=1, stat=0, len=64, token="Last Token before EOF"
EOF Found
l=1, c=1, stat=0, len=64, token="Next token bad quotes"