Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ on: [push]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/alibaba/qlexpress4/aparser/QLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ private void readQuoteString() {
continue;
}
if (c == '\'') {
add(QuoteStringLiteral, script.substring(start, p), start, p - 1, startLine, startCol);
add(QuoteStringLiteral, normalizeNewlines(script.substring(start, p)), start, p - 1, startLine, startCol);
return;
}
}
Expand All @@ -454,7 +454,7 @@ private void readDoubleQuoteString() {
if (c == '"') {
if (p > textStart) {
add(StaticStringCharacters,
script.substring(textStart, p),
normalizeNewlines(script.substring(textStart, p)),
textStart,
p - 1,
textLine,
Expand Down Expand Up @@ -484,7 +484,7 @@ private void readDoubleQuoteString() {
}
}
if (p > textStart) {
add(DyStrText, script.substring(textStart, p), textStart, p - 1, textLine, textCol);
add(DyStrText, normalizeNewlines(script.substring(textStart, p)), textStart, p - 1, textLine, textCol);
}
if (eof()) {
scannerError(currentToken(script.substring(quoteStart)), "unterminated string literal");
Expand Down Expand Up @@ -948,4 +948,8 @@ private void scannerError(Token token, String reason) {
QLErrorCodes.SYNTAX_ERROR.name(),
reason);
}

private static String normalizeNewlines(String text) {
return text.replace("\r\n", "\n").replace("\r", "\n");
}
}