concat weirdness
Mar 5, 2021 22:55:37 GMT 1
Post by rikky on Mar 5, 2021 22:55:37 GMT 1
hello
following errors in both the latest stable and the latest fossil.sh
result:
The error lies somewhere in the lines:
For if I replace these texts with empty strings, it compiles well.
So following compiles well:
Putting back either one of these lines errors.
I tried but failed to find the cause.
Rik
PS. It did work, for I only did a recompile after a minor improvement somewhere completely else.
following errors in both the latest stable and the latest fossil.sh
help$ = NL$ & \
"TOKEN [option] haystack$ n [delimiter$]" & NL$ & \
NL$ & \
"haystack$ can be replaced with piped input." & NL$ & \
NL$ & \
"Returns the nth token in haystack$ split by delimiter$. The delimiter$ is " & NL$ & \
"optional. If it is omitted, then the definition from OPTION DELIM is assumed." & NL$ & \
"When specified, it may consist of multiple characters. If delimiter$ occurs " & NL$ & \
"between double quotes in haystack$, then it is ignored. This behavior can be" & NL$ & \
"changed by setting OPTION QUOTED to FALSE. Use the OPTION COLLAPSE TRUE to " & NL$ & \
"collapse multiple delimiters into one. If the indicated position is outside" & NL$ & \
"a valid range, the result will be an empty string. Use the FLATTEN$ function to " & NL$ & \
"flatten out the returned token. See also ISTOKEN, AMOUNT and SPLIT. " & NL$ & \
NL$ & \
"options :" & NL$ & \
" -v --version print version." & NL$ & \
" -h --help print help." & NL$ & \
NL$ & \
"example:" & NL$ & \
NL$ & \
"TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6" & NL$ & \
"cat file1 | TOKEN 4 $'\n'" & NL$ & \
NL$ & \
"export QUOTED=FALSE" & NL$ & \
"TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6" & NL$ & \
"FLATTEN $(TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6)" & NL$ & \
""
result:
Converting 'Playroom/test.bac'... done, 34 lines were processed in 21 seconds.
Creating lexical analyzer... done.
Compiling 'Playroom/test.bac'... cc -c test.bac.c
Makefile.bacon:6: recipe for target 'test.bac.o' failed
test.bac:27:1889: error: expected ')' before ';' token
INFO: see full error report (y/[n])? y
test.bac: In function 'main':
test.bac:27:1889: error: expected ')' before ';' token
test.bac:29:1: error: expected ';' before '}' token
make: *** [test.bac.o] Error 1
The error lies somewhere in the lines:
"export QUOTED=FALSE" & NL$ & \
"TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6" & NL$ & \
For if I replace these texts with empty strings, it compiles well.
So following compiles well:
help$ = NL$ & \
"TOKEN [option] haystack$ n [delimiter$]" & NL$ & \
NL$ & \
"haystack$ can be replaced with piped input." & NL$ & \
NL$ & \
"Returns the nth token in haystack$ split by delimiter$. The delimiter$ is " & NL$ & \
"optional. If it is omitted, then the definition from OPTION DELIM is assumed." & NL$ & \
"When specified, it may consist of multiple characters. If delimiter$ occurs " & NL$ & \
"between double quotes in haystack$, then it is ignored. This behavior can be" & NL$ & \
"changed by setting OPTION QUOTED to FALSE. Use the OPTION COLLAPSE TRUE to " & NL$ & \
"collapse multiple delimiters into one. If the indicated position is outside" & NL$ & \
"a valid range, the result will be an empty string. Use the FLATTEN$ function to " & NL$ & \
"flatten out the returned token. See also ISTOKEN, AMOUNT and SPLIT. " & NL$ & \
NL$ & \
"options :" & NL$ & \
" -v --version print version." & NL$ & \
" -h --help print help." & NL$ & \
NL$ & \
"example:" & NL$ & \
NL$ & \
"TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6" & NL$ & \
"cat file1 | TOKEN 4 $'\n'" & NL$ & \
NL$ & \
"" & NL$ & \
"" & NL$ & \
"FLATTEN $(TOKEN 'a b c d " & CHR$(34) & "e f" & CHR$(34) & " g h i j' 6)" & NL$ & \
""
Putting back either one of these lines errors.
I tried but failed to find the cause.
Rik
PS. It did work, for I only did a recompile after a minor improvement somewhere completely else.