Просмотр исходного кода

Merge pull request #133 from benjaminBrownlee/preproc-define-fix

fix: allow preproc define without value to preceed a line with whitespace
pull/140/head
Amaan Qureshi 3 лет назад
committed by GitHub
Родитель
Сommit
a60f1ddef4
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
4 измененных файлов: 4273 добавлений и 4385 удалений
  1. +1
    -1
      grammar.js
  2. +2
    -5
      src/grammar.json
  3. +4269
    -4378
      src/parser.c
  4. +1
    -1
      test/corpus/preprocessor.txt

+ 1
- 1
grammar.js Просмотреть файл

@ -127,7 +127,7 @@ module.exports = grammar({
...preprocIf('_in_field_declaration_list', $ => $._field_declaration_list_item), ...preprocIf('_in_field_declaration_list', $ => $._field_declaration_list_item),
preproc_directive: _ => /#[ \t]*[a-zA-Z]\w*/, preproc_directive: _ => /#[ \t]*[a-zA-Z]\w*/,
preproc_arg: _ => token(prec(-1, repeat1(/.|\\\r?\n/))),
preproc_arg: _ => token(prec(-1, /\S(.|\\\r?\n)*/)),
_preproc_expression: $ => choice( _preproc_expression: $ => choice(
$.identifier, $.identifier,

+ 2
- 5
src/grammar.json Просмотреть файл

@ -792,11 +792,8 @@
"type": "PREC", "type": "PREC",
"value": -1, "value": -1,
"content": { "content": {
"type": "REPEAT1",
"content": {
"type": "PATTERN",
"value": ".|\\\\\\r?\\n"
}
"type": "PATTERN",
"value": "\\S(.|\\\\\\r?\\n)*"
} }
} }
}, },

+ 4269
- 4378
src/parser.c
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 1
- 1
test/corpus/preprocessor.txt Просмотреть файл

@ -23,7 +23,7 @@ Object-like macro definitions
============================================ ============================================
#define ONE #define ONE
#define TWO int a = b;
#define TWO int a = b;
#define THREE \ #define THREE \
c == d ? \ c == d ? \
e : \ e : \

Загрузка…
Отмена
Сохранить