Fixed CRLF behavior for tests, run tests on all platforms in GitHub CI (#106)

* Fixed CRLF issues in tests

* Added GH CI to ensure tests pass on all platforms
This commit is contained in:
Andrew Helwer 2021-09-25 16:59:45 -04:00 committed by GitHub
parent 3243c9ab73
commit af9646bad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 117194 additions and 116440 deletions

22
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Build & Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm install
- run: node_modules/.bin/tree-sitter test

View File

@ -44,7 +44,9 @@ module.exports = grammar({
extras: $ => [
$.comment,
/\\?\s/,
/\s/,
/\\\r?\n/,
/\\( |\t|\v|\f)/
],
supertypes: $ => [
@ -465,7 +467,7 @@ module.exports = grammar({
'"'
),
_string_content: $ => token(prec(-1, /([^"`$\\]|\\(.|\n))+/)),
_string_content: $ => token(prec(-1, /([^"`$\\]|\\(.|\r?\n))+/)),
array: $ => seq(
'(',

12
src/grammar.json vendored
View File

@ -2041,7 +2041,7 @@
"value": -1,
"content": {
"type": "PATTERN",
"value": "([^\"`$\\\\]|\\\\(.|\\n))+"
"value": "([^\"`$\\\\]|\\\\(.|\\r?\\n))+"
}
}
},
@ -2526,7 +2526,15 @@
},
{
"type": "PATTERN",
"value": "\\\\?\\s"
"value": "\\s"
},
{
"type": "PATTERN",
"value": "\\\\\\r?\\n"
},
{
"type": "PATTERN",
"value": "\\\\( |\\t|\\v|\\f)"
}
],
"conflicts": [],

233587
src/parser.c vendored

File diff suppressed because it is too large Load Diff

3
src/scanner.cc vendored
View File

@ -220,6 +220,9 @@ struct Scanner {
skip(lexer);
} else if (lexer->lookahead == '\\') {
skip(lexer);
if (lexer->lookahead == '\r') {
skip(lexer);
}
if (lexer->lookahead == '\n') {
skip(lexer);
} else {

View File

@ -102,8 +102,8 @@ struct TSLanguage {
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSParseActionEntry *parse_actions;
const char **symbol_names;
const char **field_names;
const char * const *symbol_names;
const char * const *field_names;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const TSSymbolMetadata *symbol_metadata;