瀏覽代碼

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
父節點
當前提交
a60f1ddef4
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 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),
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(
$.identifier,

+ 2
- 5
src/grammar.json 查看文件

@ -792,11 +792,8 @@
"type": "PREC",
"value": -1,
"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 TWO int a = b;
#define TWO int a = b;
#define THREE \
c == d ? \
e : \

Loading…
取消
儲存