@@ -61,7 +61,7 @@ variables:
6161 control_keywords : ' break|case|catch|continue|default|do|else|for|goto|if|_Pragma|switch|throw|try|while|{{coroutine_keywords}}'
6262 memory_operators : ' new|delete'
6363 basic_types : ' asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void'
64- before_tag : ' struct|union|enum\s+class|enum\s+struct|enum|class'
64+ before_tag : ' struct|union|enum\s+class|enum\s+struct|enum|class|concept '
6565 declspec : ' __declspec\(\s*\w+(?:\([^)]+\))?\s*\)'
6666 storage_classes : ' static|export|extern|friend|explicit|virtual|register|thread_local'
6767 type_qualifier : ' const|mutable|typename|volatile'
@@ -745,7 +745,10 @@ contexts:
745745 - meta_content_scope : meta.template.c++
746746 - match : ' >'
747747 scope : meta.template.c++ punctuation.definition.generic.end.c++
748- pop : true
748+ set :
749+ - include : constraint-requires
750+ - match : (?=\S)
751+ pop : true
749752 - match : \.{3}
750753 scope : keyword.operator.variadic.c++
751754 - match : \b(typename|{{before_tag}})\b
@@ -759,6 +762,26 @@ contexts:
759762 scope : keyword.declaration.c++
760763 - include : template-common
761764
765+ requires :
766+ - match : \brequires\b
767+ scope : keyword.operator.word.c++
768+ push : function-definition-params
769+
770+ constraint :
771+ - match : (?=;)
772+ pop : true
773+ - include : requires
774+ - include : expressions-minus-generic-type-function-call
775+
776+ constraint-requires :
777+ - match : ' \brequires\b'
778+ scope : storage.modifier.c++
779+ push :
780+ - meta_scope : meta.constraint.c++
781+ - match : (?=\{|{{identifier}}\s*{{identifier}}\(|{{before_tag}}|:)
782+ pop : true
783+ - include : constraint
784+
762785 generic-type :
763786 - match : ' (?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*(\(|\{))'
764787 push :
@@ -1248,6 +1271,7 @@ contexts:
12481271 scope : punctuation.separator.c++
12491272 set : function-definition-trailing-return
12501273 - include : function-specifiers
1274+ - include : constraint-requires
12511275 - match : ' ='
12521276 scope : keyword.operator.assignment.c++
12531277 - match : ' &'
@@ -1268,6 +1292,7 @@ contexts:
12681292 - match : ' (?=\{)'
12691293 set : function-definition-body
12701294 - include : function-specifiers
1295+ - include : constraint-requires
12711296 - include : function-trailing-return-type
12721297
12731298 function-definition-body :
@@ -1303,6 +1328,9 @@ contexts:
13031328 - match : ' \bunion\b'
13041329 scope : keyword.declaration.union.type.c++
13051330 set : data-structures-union-definition
1331+ - match : ' \bconcept\b'
1332+ scope : meta.concept.c++ keyword.declaration.concept.c++
1333+ set : data-structures-concept-definition
13061334 - match : ' (?=\S)'
13071335 pop : true
13081336
@@ -1463,6 +1491,17 @@ contexts:
14631491 - match : ' (?=;)'
14641492 pop : true
14651493
1494+ data-structures-concept-definition :
1495+ - meta_content_scope : meta.concept.c++
1496+ - include : data-structures-definition-common-begin
1497+ - match : ' ({{identifier}})\s+(=)'
1498+ captures :
1499+ 1 : entity.name.concept.c++
1500+ 2 : keyword.operator.assignment.c++
1501+ set :
1502+ - meta_content_scope : meta.concept.c++ meta.constraint.c++
1503+ - include : constraint
1504+
14661505 data-structures-definition-common-begin :
14671506 - include : comments
14681507 - match : ' (?=\b(?:{{before_tag}}|{{control_keywords}})\b)'
@@ -1725,6 +1764,7 @@ contexts:
17251764 scope : punctuation.separator.c++
17261765 set : method-definition-trailing-return
17271766 - include : function-specifiers
1767+ - include : constraint-requires
17281768 - match : ' ='
17291769 scope : keyword.operator.assignment.c++
17301770 - match : ' &'
0 commit comments