Amaan Qureshi
16456ce9a1
fix: comments can have multiple delimiting backslashes
il y a 3 ans
Amaan Qureshi
d4a789bf07
feat: support omitting consequences in conditional expressions
It's allowed in gcc and clang
il y a 3 ans
Jade Lovelace
93135e2eb5
fix: implement Unicode identifiers
According to cppreference, identifiers are `(XID_Start | '_')
XID_Continue*`, which is the case as of C++23 and C2x. I have confirmed
this myself with the drafts of C++23 and C2x.
https://en.cppreference.com/w/cpp/language/identifiers
Clang indeed implements identifiers as `(XID_Start | '_') XID_Continue*`
in C++ mode and C2x mode, with a slight extension to the character set
to include some extra math characters:
231992d9b8/clang/lib/Lex/Lexer.cpp (L1517-L1530)
il y a 3 ans
Ismail A Bella
94bc261b1a
fix: allow multiple expressions inside for_statement condition
il y a 4 ans
John Drouhard
179b70c6be
Attributes: simplify attributed_statement by making it a valid type of non-case statement
This also lets it bind to _any_ statement, which is necessary for some
c++ attributes that can attach to the statement in if, while, and
do/while statements.
il y a 4 ans
Ben Dunkin
517bf92b2c
add the body label to for loops to make it the same as other loops ( #110 )
il y a 4 ans
John Drouhard
f71e80b9f2
Extract "..." into a named node called variadic_parameter. Fixes #73
il y a 4 ans
jdrouhard
9bee34500c
Support attribute statements under case statements ( #83 )
il y a 4 ans
John Drouhard
0aeed5578a
Fix indent-level whitespace
il y a 4 ans
John Drouhard
b50e693547
Separate _declaration_modifiers from _declaration_specifiers to make it overridable in the cpp grammar
il y a 4 ans
John Drouhard
0b714a5134
rename attribute_definition to attribute_declaration
il y a 4 ans
jdrouhard
8fc135a72b
Add support for C23 attributes ( #81 )
* Add support for C23 attributes
https://en.cppreference.com/w/c/language/attributes
* Use wrapper for statements with attributes to reduce state machine size
* Missed a couple _declarators that needed attributes directly after
* Use annotated_declarator for declarators that have attributes immediately following them
* Give field and type declarators the same attribute treatment
il y a 4 ans
berchn
008008e30a
Add operator field to field_expression ( #69 )
il y a 5 ans
berchn
25fb87ce98
Add operation field to assignment_expression ( #68 )
il y a 5 ans
Mathieu Nayrolles
88592f162e
Add support for Microsoft-specific modifiers ( #40 )
* Add support for Microsoft-specific modifiers
Microsoft-specific modifiers are keywords can be used to modify declarators to form derived types.
The specification for the modifiers themselves is here:
https://docs.microsoft.com/en-us/cpp/cpp/microsoft-specific-modifiers?view=vs-2019
* 0.16.1
il y a 6 ans
calixteman
6002fcd5e8
Add a rule for left part of assignment: it'll be helpful to add scope… ( #37 )
* Add a rule for left part of assignment: it'll be helpful to add scoped_name_identifier (c++)
* Inline the assignment_left_expression rule
il y a 6 ans
calixteman
c455818961
#include can be followed by a macro name or a macro call ( #38 )
* #include can be followed by a macro name or a macro call
* In preproc_include, use preproc_call_expression
il y a 6 ans
Max Brunsfeld
b6ff8fbdaf
Handle line continuations with CRLF endings
il y a 6 ans
calixteman
362c031880
Parse expressions in preprocessor #if statement ( #29 )
* Parse expressions in preprocessor #if statement
* Make preproc_expression look like a normal expression
* Hide the wrapper rules
* Alias the rulres to match their corresponding expression rule
* Handle line continuations as extra tokens
il y a 6 ans
calixteman
2ed529f075
Add u|U|u8 string|char support ( #36 )
il y a 6 ans
Max Brunsfeld
627806ec6a
Allow case statements separate from switch statements
Fixes #32
il y a 6 ans
Max Brunsfeld
916be99704
Allow comma operator in return statement
Fixes #31
il y a 6 ans
calixteman
c578638af2
Fix multi-statements in for initializer and update parts ( #27 )
* Fix multi-statements in for initializer and update parts
* Finally the bug was only in the initializer part
il y a 7 ans
calixteman
c8061429cc
Fix error with ++L (consequence of support for L strings) ( #26 )
* Fix error with ++L (consequence of support for L strings)
* Update to tree-sitter 0.15.5
il y a 7 ans
Max Brunsfeld
e0512072cc
Handle comments with escaped CRLF line endings
Fixes #24
il y a 7 ans
Max Brunsfeld
0bc1adf0c2
Tweak fields
il y a 7 ans
Max Brunsfeld
c3965938cc
Add node fields, update tree-sitter-cli
il y a 7 ans
calixteman
ff4fc1c785
Handle L-strings and L-chars ( #25 )
il y a 7 ans
calixteman
2945de0173
Fix precedences of * (deref) and & (address-of) ( #21 )
il y a 7 ans
calixteman
adf868ce9a
Fix parenthesized expression on left side of assignment ( #22 )
il y a 7 ans
calixteman
fb9fbd83f0
Handle __attribute__ in function declaration ( #19 )
* Handle __attribute__ in function declaration
* Fix tests in examples/
* Remove useless optional
il y a 7 ans
Calixte Denizet
338f99e8a0
Fix comment containing backslash
il y a 7 ans
Max Brunsfeld
42382f29bf
Restrict expressions that can appear as lhs in assignment
il y a 7 ans
Max Brunsfeld
fd42e75886
Flesh out number literal parsing
Fixes atom/language-c#323
il y a 7 ans
Max Brunsfeld
175d93b439
Handle postfix type qualifiers in compound literals
Fixes atom/language-c#312
il y a 7 ans
Max Brunsfeld
95b5710ff9
Allow number literals with 'f' suffix and digit separators
Fixes tree-sitter/tree-sitter-cpp#24
Fixes tree-sitter/tree-sitter-cpp#34
il y a 7 ans
Max Brunsfeld
5a25ac2983
Allow multiple names to be defined in a typedef statement
Fixes tree-sitter/tree-sitter-cpp#30
il y a 7 ans
Max Brunsfeld
50c3a02bc7
Allow preprocessor directives in field decl lists
Fixes tree-sitter/tree-sitter-cpp#29
il y a 7 ans
Max Brunsfeld
1358e07759
Allow escaped newlines in single-line comments
Fixes tree-sitter/tree-sitter-cpp#26
il y a 7 ans
Max Brunsfeld
5b250e138a
Remove distinction between top-level and statement block items
il y a 7 ans
Max Brunsfeld
a71bef804d
Fix inefficient string tokenization
il y a 7 ans
Max Brunsfeld
7f827b42a8
Add explicit nodes for bitfield clauses
il y a 7 ans
Max Brunsfeld
ce980349b2
Fix preprocessor argument parsing with CRLF line endings
Fixes #11
il y a 7 ans
Max Brunsfeld
176fd5f077
Add signed keyword
Fixes #10
il y a 7 ans
Max Brunsfeld
2af332790e
Make case statements contain all subsequent statements until the next case
il y a 7 ans
Max Brunsfeld
6cbb20b681
Allow any sort of statement at the top level, not just calls
This way, we can parse snippets of C, like expressions, in the
case where C code is injected into a larger document.
il y a 7 ans
Max Brunsfeld
ed56d5e288
Fix array declarator parsing
Refs https://github.com/atom/atom/issues/18346#issuecomment-433734281
il y a 7 ans
Max Brunsfeld
6744ae08ea
Parse top-level macro invocations
Fixes atom/atom#18346
il y a 7 ans
Max Brunsfeld
5b5300388e
Add low dynamic precedence on macro_type_specifier
il y a 7 ans
Max Brunsfeld
07cafeac95
Use dynamic precedence to distinguish pointer declarators from multiplication
il y a 8 ans