1 ;;; c.by -- LL grammar for C/C++ language specification
2 ;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
4 ;; Author: Eric M. Ludlam <zappo@gnu.org>
5 ;; David Ponce <david@dponce.com>
6 ;; Klaus Berndl <klaus.berndl@sdm.de>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23 ;; TODO: From Nate Schley
24 ;; > * Can't parse signature element: "const char* const rmc_ClrTxt"
25 ;; > * Can't parse signature element: "char* const dellog_ClrTxt"
26 ;; > * Can't parse signature element: "const char* dellog_SetTxt"
27 ;; > * Can't parse signature element: "const RmcCmdSSPADetailedStatus& status"
29 ;; > And FWIW I have seen the following argument cases not handled, even
30 ;; > with no leading/trailing spaces in the split:
32 ;; > * Can't parse signature element: "const bool currentAlarmStatus"
33 ;; > * Can't parse signature element: "unsigned char mode"
34 ;; > * Can't parse signature element: "TskTimingTask* tsktimingtask"
35 ;; > * Can't parse signature element: "unsigned char htrStatus"
36 ;; > * Can't parse signature element: "char trackPower[]"
37 ;; > * Can't parse signature element: "const RmcCmdMCDetailedStatus& status"
38 ;; > * Can't parse signature element: "RmcBucStatus* rftBucStatus"
40 %package semantic-c-by
41 %provide semantic/bovine/c-by
44 (declare-function semantic-c-reconstitute-token "semantic/bovine/c"
45 (tokenpart declmods typedecl))
46 (declare-function semantic-c-reconstitute-template "semantic/bovine/c"
48 (declare-function semantic-expand-c-tag "semantic/bovine/c" (tag))
49 (declare-function semantic-parse-region "semantic"
50 (start end &optional nonterminal depth returnonerror))
53 %languagemode c-mode c++-mode
57 %token <punctuation> HASH "\\`[#]\\'"
58 %token <punctuation> PERIOD "\\`[.]\\'"
59 %token <punctuation> COLON "\\`[:]\\'"
60 %token <punctuation> SEMICOLON "\\`[;]\\'"
61 %token <punctuation> STAR "\\`[*]\\'"
62 %token <punctuation> AMPERSAND "\\`[&]\\'"
63 %token <punctuation> DIVIDE "\\`[/]\\'"
64 %token <punctuation> PLUS "\\`[+]\\'"
65 %token <punctuation> MINUS "\\`[-]\\'"
66 %token <punctuation> BANG "\\`[!]\\'"
67 %token <punctuation> QUESTION "\\`[?]\\'"
68 %token <punctuation> EQUAL "\\`[=]\\'"
69 %token <punctuation> LESS "\\`[<]\\'"
70 %token <punctuation> GREATER "\\`[>]\\'"
71 %token <punctuation> COMA "\\`[,]\\'"
72 %token <punctuation> TILDE "\\`[~]\\'"
73 %token <punctuation> MOD "\\`[%]\\'"
74 %token <punctuation> HAT "\\`\\^\\'"
75 %token <punctuation> OR "\\`[|]\\'"
76 %token <string> C "\"C\""
77 %token <string> CPP "\"C\\+\\+\""
78 %token <number> ZERO "^0$"
79 %token <symbol> RESTRICT "\\<\\(__\\)?restrict\\>"
80 %token <open-paren> LPAREN "("
81 %token <close-paren> RPAREN ")"
82 %token <open-paren> LBRACE "{"
83 %token <close-paren> RBRACE "}"
84 %token <semantic-list> BRACK_BLCK "\\[.*\\]$"
85 %token <semantic-list> PAREN_BLCK "^("
86 %token <semantic-list> BRACE_BLCK "^{"
87 %token <semantic-list> VOID_BLCK "^(void)$"
88 %token <semantic-list> PARENS "()"
89 %token <semantic-list> BRACKETS "\\[\\]"
91 %token EXTERN "extern"
92 %put EXTERN summary "Declaration Modifier: extern <type> <name> ..."
93 %token STATIC "static"
94 %put STATIC summary "Declaration Modifier: static <type> <name> ..."
96 %put CONST summary "Declaration Modifier: const <type> <name> ..."
97 %token VOLATILE "volatile"
98 %put VOLATILE summary "Declaration Modifier: volatile <type> <name> ..."
99 %token REGISTER "register"
100 %put REGISTER summary "Declaration Modifier: register <type> <name> ..."
101 %token SIGNED "signed"
102 %put SIGNED summary "Numeric Type Modifier: signed <numeric type> <name> ..."
103 %token UNSIGNED "unsigned"
104 %put UNSIGNED summary "Numeric Type Modifier: unsigned <numeric type> <name> ..."
106 %token INLINE "inline"
107 %put INLINE summary "Function Modifier: inline <return type> <name>(...) {...};"
108 %token VIRTUAL "virtual"
109 %put VIRTUAL summary "Method Modifier: virtual <type> <name>(...) ..."
110 %token MUTABLE "mutable"
111 %put MUTABLE summary "Member Declaration Modifier: mutable <type> <name> ..."
112 %token EXPLICIT "explicit"
113 %put EXPLICIT summary "Forbids implicit type conversion: explicit <constructor>"
115 %token STRUCT "struct"
116 %put STRUCT summary "Structure Type Declaration: struct [name] { ... };"
118 %put UNION summary "Union Type Declaration: union [name] { ... };"
120 %put ENUM summary "Enumeration Type Declaration: enum [name] { ... };"
121 %token TYPEDEF "typedef"
122 %put TYPEDEF summary "Arbitrary Type Declaration: typedef <typedeclaration> <name>;"
124 %put CLASS summary "Class Declaration: class <name>[:parents] { ... };"
125 %token TYPENAME "typename"
126 %put TYPENAME summary "typename is used to handle a qualified name as a typename;"
127 %token NAMESPACE "namespace"
128 %put NAMESPACE summary "Namespace Declaration: namespace <name> { ... };"
130 %put USING summary "using <namespace>;"
133 %put NEW summary "new <classname>();"
134 %token DELETE "delete"
135 %put DELETE summary "delete <object>;"
137 ;; Despite this, this parser can find templates by ignoring the TEMPLATE
138 ;; keyword, and finding the class/method being templatized.
139 %token TEMPLATE "template"
140 %put TEMPLATE summary "template <class TYPE ...> TYPE_OR_FUNCTION"
143 %put THROW summary "<type> <methoddef> (<method args>) throw (<exception>) ..."
144 %token REENTRANT "reentrant"
145 %put REENTRANT summary "<type> <methoddef> (<method args>) reentrant ..."
148 %put { TRY CATCH } summary "try { <body> } catch { <catch code> }"
150 ;; Leave these alone for now.
151 %token OPERATOR "operator"
152 %token PUBLIC "public"
153 %token PRIVATE "private"
154 %token PROTECTED "protected"
155 %token FRIEND "friend"
156 %put FRIEND summary "friend class <CLASSNAME>"
158 ;; These aren't used for parsing, but is a useful place to describe the keywords.
161 %put {IF ELSE} summary "if (<condition>) { code } [ else { code } ]"
165 %put DO summary " do { code } while (<condition>);"
166 %put WHILE summary "do { code } while (<condition>); or while (<condition>) { code };"
169 %put FOR summary "for(<init>; <condition>; <increment>) { code }"
171 %token SWITCH "switch"
173 %token DEFAULT "default"
174 %put {SWITCH CASE DEFAULT} summary
175 "switch (<variable>) { case <constvalue>: code; ... default: code; }"
177 %token RETURN "return"
178 %put RETURN summary "return <value>;"
181 %put BREAK summary "Non-local exit within a loop or switch (for, do/while, switch): break;"
182 %token CONTINUE "continue"
183 %put CONTINUE summary "Non-local continue within a loop (for, do/while): continue;"
185 %token SIZEOF "sizeof"
186 %put SIZEOF summary "Compile time macro: sizeof(<type or variable>) // size in bytes"
190 %put VOID summary "Built in typeless type: void"
192 %put CHAR summary "Integral Character Type: (0 to 256)"
193 %token WCHAR "wchar_t"
194 %put WCHAR summary "Wide Character Type"
196 %put SHORT summary "Integral Primitive Type: (-32768 to 32767)"
198 %put INT summary "Integral Primitive Type: (-2147483648 to 2147483647)"
200 %put LONG summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)"
202 %put FLOAT summary "Primitive floating-point type (single-precision 32-bit IEEE 754)"
203 %token DOUBLE "double"
204 %put DOUBLE summary "Primitive floating-point type (double-precision 64-bit IEEE 754)"
206 %put BOOL summary "Primitive boolean type"
209 %token UNDERUNDERP "__P"
210 %put UNDERP summary "Common macro to eliminate prototype compatibility on some compilers"
211 %put UNDERUNDERP summary "Common macro to eliminate prototype compatibility on some compilers"
218 ;; TODO: Klaus Berndl: Is the define here necessary or even wrong?
219 ;; Is this part not already covered by macro??
229 | codeblock-var-or-fun
230 | type ;; type is less likely to be used here.
243 : EXTERN C semantic-list
244 ;; Extern C commands which contain a list need to have the
245 ;; entries of the list extracted, and spliced into the main
246 ;; list of entries. This must be done via the function
247 ;; that expands singular nonterminals, such as int x,y;
248 (TAG "C" 'extern :members (EXPANDFULL $3 extern-c-contents) )
249 | EXTERN CPP semantic-list
250 (TAG "C" 'extern :members (EXPANDFULL $3 extern-c-contents) )
252 ;; A plain extern "C" call should add something to the token,
253 ;; but just strip it from the buffer here for now.
261 (VARIABLE-TAG $1 nil nil :constant-flag t )
268 ;; This is used in struct parts.
271 (VARIABLE-TAG $1 nil nil :constant-flag t)
276 ;; In C++, structures can have the same things as classes.
277 ;; So delete this some day in the figure.
279 ;;structparts : semantic-list
280 ;; (EXPANDFULL $1 structsubparts)
283 ;;structsubparts : LBRACE
289 ;; ;; sometimes there are defines in structs.
294 (EXPANDFULL $1 classsubparts)
302 ;; @todo - support 'friend' construct.
308 | class-protection opt-symbol COLON
309 ;; For QT, they may put a `slot' keyword between the protection
310 ;; and the COLON. @todo - Have the QT stuff use macros.
311 (TAG (car $1) 'label)
314 (TAG (car $2) 'friend)
315 | FRIEND CLASS symbol
324 : COLON class-parents opt-template-specifier
331 : opt-class-protection opt-class-declmods namespace-symbol
332 (TYPE-TAG (car $3) "class" nil nil :protection (car $1))
333 | opt-class-declmods opt-class-protection namespace-symbol
334 (TYPE-TAG (car $3) "class" nil nil :protection (car $2))
338 : one-class-parent COMA class-parents
345 : class-declmods opt-class-declmods
363 | ;;EMPTY - Same as private
369 (EXPANDFULL $1 namespacesubparts)
380 | class-protection COLON
381 (TAG (car $1) 'label)
382 ;; In C++, this label in a classsubpart represents
383 ;; PUBLIC or PRIVATE bits. Ignore them for now.
386 ;; Includes inside namespaces
388 (TAG $1 'include :inside-ns t)
394 (EXPANDFULL $1 enumsubparts)
399 (VARIABLE-TAG $1 "int" (car $2) :constant-flag t )
415 : struct-or-class opt-class opt-name opt-template-specifier
416 opt-class-parents semantic-list
417 (TYPE-TAG (car $3) (car $1)
418 (let ((semantic-c-classname (cons (car ,$3) (car ,$1))))
419 (EXPANDFULL $6 classsubparts))
421 :template-specifier $4
423 | struct-or-class opt-class opt-name opt-template-specifier
425 (TYPE-TAG (car $3) (car $1) nil $5
426 :template-specifier $4
429 | UNION opt-class opt-name unionparts
430 (TYPE-TAG (car $3) $1 $4 nil
432 | ENUM opt-class opt-name enumparts
433 (TYPE-TAG (car $3) $1 $4 nil
435 ;; Klaus Berndl: a typedef can be a typeformbase with all this
437 | TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list
438 ;;;; We put the type this typedef renames into PARENT
439 ;;;; but will move it in the expand function.
440 (TYPE-TAG $5 $1 nil (list $3) )
444 : typedefname COMA typedef-symbol-list
450 ;; TODO: Klaus Berndl: symbol -> namespace-symbol?! Answer: Probably
451 ;; symbol is correct here!
453 : opt-stars symbol opt-bits opt-array
463 : typesimple SEMICOLON
465 ;; named namespaces like "namespace XXX {"
466 | NAMESPACE symbol namespaceparts
467 (TYPE-TAG $2 $1 $3 nil )
468 ;; unnamed namespaces like "namespace {"
469 | NAMESPACE namespaceparts
470 (TYPE-TAG "unnamed" $1 $2 nil )
471 ;; David Engster: namespace alias like "namespace foo = bar;"
472 | NAMESPACE symbol EQUAL typeformbase SEMICOLON
473 (TYPE-TAG $2 $1 (list (TYPE-TAG (car $4) $1 nil nil)) nil :kind 'alias )
476 ;; Klaus Berndl: We must parse "using namespace XXX" too
478 ;; Using is vaguely like an include statement in the named portions
479 ;; of the code. We should probably specify a new token type for this.
482 : USING usingname SEMICOLON
483 (TAG (car $2) 'using :type ,$2 )
486 ;; Jan Moringen: Differentiate between 'using' and 'using namespace'
487 ;; Adapted to creating type tags by EML.
490 (TYPE-TAG (car $1) "class" nil nil :prototype t)
491 | NAMESPACE typeformbase
492 (TYPE-TAG (car $2) "namespace" nil nil :prototype t)
496 : TEMPLATE template-specifier opt-friend template-definition
497 ( ,(semantic-c-reconstitute-template $4 ,$2) )
505 opt-template-specifier
513 : LESS template-specifier-types GREATER
517 template-specifier-types
518 : template-var template-specifier-type-list
523 template-specifier-type-list
524 : COMA template-specifier-types
531 ;; : template-type opt-stars opt-template-equal
532 ;; ( ,(cons (concat (car $1) (make-string (car ,$2) ?*))
534 ;; ;; Klaus Berndl: for template-types the template-var can also be
535 ;; ;; literals or constants. Example: map<ClassX, ClassY, 10>
536 ;; ;; map_size10_var; This parses also template<class T, 0> which is
537 ;; ;; nonsense but who cares....
546 ;; Klaus Berndl: The following handles all template-vars of
547 ;; template-definitions
548 template-type opt-template-equal
549 ( ,(cons (car $1) (cdr $1)) )
550 ;; Klaus Berndl: for template-types the template-var can also be
551 ;; literals or constants.
552 ;; Example: map<ClassX, ClassY, 10> map_size10_var; This parses also
553 ;; template<class T, 0> which is nonsense but who cares....
558 ;; Klaus Berndl: In template-types arguments can be any symbols with
559 ;; optional address-operator (&) and optional dereferencing operator
560 ;; (*). Example map<ClassX, ClassY, *size_var_ptr> sized_map_var.
561 | opt-stars opt-ref namespace-symbol
563 ;; Some code can compile down into a number, but starts out as an
564 ;; expression, such as "sizeof(a)", or (sizeof(a)/sizeof(b))
567 | SIZEOF semantic-list
572 : EQUAL symbol LESS template-specifier-types GREATER
582 (TYPE-TAG $2 "class" nil nil )
584 (TYPE-TAG $2 "struct" nil nil )
585 ;; TODO: Klaus Berndl: For the moment it is ok, that we parse the C++
586 ;; keyword typename as a class....
588 (TYPE-TAG $2 "class" nil nil)
589 ;; Klaus Berndl: template-types can be all flavors of variable-args
590 ;; but here the argument is ignored, only the type stuff is needed.
591 | declmods typeformbase cv-declmods opt-stars
592 opt-ref variablearg-opt-name
593 (TYPE-TAG (car $2) nil nil nil
594 :template-specifier (plist-get (nth 2 $2) :template-specifier)
595 :constant-flag (if (member "const" (append $1 $3)) t nil)
596 :typemodifiers (delete "const" (append $1 $3))
611 : STAR opt-starmod opt-stars
618 : STARMOD opt-starmod
619 ( ,(cons (,car ,$1) $2) )
630 ( ,(cons ,(car ,$1) $2 ) )
641 ;; Klaus Berndl: IMHO signed and unsigned are not decl-modes but
642 ;; these are only valid for some buildin-types like short, int
643 ;; etc... whereas "real" declmods are valid for all types, buildin
644 ;; and user-defined! SIGNED UNSIGNED
648 ;; Klaus Berndl: There can be a few cases where TYPENAME is not
649 ;; allowed in C++-syntax but better than not recognizing the allowed
653 ;; This is a hack in case we are in a class.
670 : CVDECLMOD cv-declmods
671 ( ,(cons ,(car ,$1) $2 ) )
683 ;; C++: A type can be modified into a reference by "&"
695 (TYPE-TAG $2 $1 nil nil )
697 (TYPE-TAG $2 $1 nil nil )
699 (TYPE-TAG $2 $1 nil nil )
702 | symbol template-specifier
703 (TYPE-TAG $1 "class" nil nil :template-specifier $2)
704 ;;| namespace-symbol opt-stars opt-template-specifier
705 ;;| namespace-symbol opt-template-specifier
706 | namespace-symbol-for-typeformbase opt-template-specifier
707 (TYPE-TAG (car $1) "class" nil nil
708 :template-specifier $2)
718 ;; Klaus Berndl: builtintype-types was builtintype
722 ;; Klaus Berndl: Added WCHAR
725 ( (concat $1 " " $2) )
729 ( (concat $1 " " $2) )
734 ( (concat $1 " " $2) )
735 ;; TODO: Klaus Berndl: Is there a long long, i think so?!
737 ( (concat $1 " " $2) )
742 : signedmod builtintype-types
743 ( (concat (car $1) " " (car $2)) )
746 ;; Klaus Berndl: unsigned is synonym for unsigned int and signed for
747 ;; signed int. To make this confusing stuff clear we add here the
750 ( (concat (car $1) " int") )
753 ;; Klaus Berndl: This parses also nonsense like "const volatile int
754 ;; const volatile const const volatile a ..." but IMHO nobody writes
755 ;; such code. Normally we should define a rule like typeformbase-mode
756 ;; which exactly defines the different allowed cases and combinations
757 ;; of declmods (minus the CVDECLMOD) typeformbase and cv-declmods so
758 ;; we could recognize more invalid code but IMHO this is not worth the
761 : declmods typeformbase declmods
762 opt-ref var-or-func-decl
763 ( ,(semantic-c-reconstitute-token ,$5 $1 $2 ) )
767 : codeblock-var-or-fun
769 ;; it is possible for a function to not have a type, and
770 ;; it is then assumed to be an int. How annoying.
771 ;; In C++, this could be a constructor or a destructor.
772 ;; Even more annoying. Only ever do this for regular
773 ;; top-level items. Ignore this problem in code blocks
774 ;; so that we don't have to deal with regular code
775 ;; being erroneously converted into types.
776 | declmods var-or-func-decl
777 ( ,(semantic-c-reconstitute-token ,$2 $1 nil ) )
788 : opt-stars opt-class opt-destructor functionname
789 opt-template-specifier
792 opt-post-fcn-modifiers
797 ;; Extra stuff goes in here.
798 ;; Continue with the stuff we found in
800 $2 $3 $7 $9 $8 ,$1 ,$11 $5 ,$10)
801 | opt-stars opt-class opt-destructor functionname
802 opt-template-specifier
804 ;; arg-list - - ini this case, a try implies a fcn.
805 opt-post-fcn-modifiers
810 ;; Extra stuff goes in here.
811 ;; Continue with the stuff we found in
813 $2 $3 nil $8 $7 ,$1 ,$10 $5 ,$9)
817 : varnamelist SEMICOLON
829 ;; Klaus Berndl: symbol -> namespace-symbol
831 : COLON namespace-symbol semantic-list opt-initializers
832 | COMA namespace-symbol semantic-list opt-initializers
836 opt-post-fcn-modifiers
837 : post-fcn-modifiers opt-post-fcn-modifiers
838 ( ,(cons ,(car $1) $2) )
849 : THROW semantic-list
850 ( EXPAND $2 throw-exception-list )
854 ;; Is this true? I don't actually know.
856 : namespace-symbol COMA throw-exception-list
857 ( ,(cons (car $1) $3) )
858 | namespace-symbol RPAREN
862 | LPAREN throw-exception-list
876 : BRACK_BLCK opt-array
877 ;; Eventually we want to replace the 1 below with a size
879 ( (cons 1 (car ,$2) ) )
896 ;; Klaus Berndl: symbol -> namespace-symbol?! I think so. Can be that
897 ;; then also some invalid C++-syntax is parsed but this is better than
898 ;; not parsing valid syntax.
900 : opt-stars opt-restrict namespace-symbol opt-bits opt-array
904 ;; I should store more in this def, but leave it simple for now.
905 ;; Klaus Berndl: const and volatile can be written after the type!
907 : declmods typeformbase cv-declmods opt-ref variablearg-opt-name opt-assign
908 ( VARIABLE-TAG (list (append $5 ,$6)) $2 nil
909 :constant-flag (if (member "const" (append $1 $3)) t nil)
910 :typemodifiers (delete "const" (append $1 $3))
918 | semantic-list arg-list
919 ( (car ( EXPAND $1 function-pointer )) $2)
920 ;; Klaus Berndl: This allows variableargs without an arg-name being
921 ;; parsed correctly even if there several pointers (*)
923 ( "" ,$1 nil nil nil )
926 varname-opt-initializer
933 : opt-ref varname varname-opt-initializer COMA varnamelist
934 ( ,(cons (append $2 $3) $5) )
935 | opt-ref varname varname-opt-initializer
939 ;; Klaus Berndl: Is necessary to parse stuff like
940 ;; class list_of_facts : public list<fact>, public entity
942 ;; list <shared_ptr<item> >::const_iterator l;
943 ;; Parses also invalid(?) and senseless(?) c++-syntax like
944 ;; symbol<template-spec>::symbol1<template-spec1>::test_iterator
945 ;; but better parsing too much than to less
947 : symbol opt-template-specifier COLON COLON namespace-symbol
948 ( (concat $1 "::" (car $5)) )
949 | symbol opt-template-specifier
953 ;; Don't pull an optional template specifier at the end of the
954 ;; namespace symbol so that it can be picked up by the type.
955 namespace-symbol-for-typeformbase
956 : symbol opt-template-specifier COLON COLON namespace-symbol-for-typeformbase
957 ( (concat $1 "::" (car $5)) )
962 ;; : symbol COLON COLON namespace-symbol
963 ;; ( (concat $1 "::" (car $4)) )
969 : symbol COLON COLON namespace-opt-class
970 ( (concat $1 "::" (car $4)) )
971 ;; Klaus Berndl: We must recognize template-specifiers here so we can
972 ;; parse correctly the method-implementations of template-classes
973 ;; outside the template-class-declaration Example:
974 ;; TemplateClass1<T>::method_1(...)
975 | symbol opt-template-specifier COLON COLON
979 ;; Klaus Berndl: The opt-class of a func-decl must be able to
980 ;; recognize opt-classes with namespaces, e.g.
981 ;; Test1::Test2::classname::
983 : namespace-opt-class
997 : PAREN_BLCK knr-arguments
1000 (EXPANDFULL $1 arg-sub-list)
1006 : varname COMA knr-varnamelist
1013 knr-one-variable-decl
1014 : declmods typeformbase cv-declmods knr-varnamelist
1015 ( VARIABLE-TAG (nreverse $4) $2 nil
1016 :constant-flag (if (member "const" (append $3)) t nil)
1017 :typemodifiers (delete "const" $3)
1022 : knr-one-variable-decl SEMICOLON knr-arguments
1023 ( ,(append (semantic-expand-c-tag ,$1) ,$3) )
1024 | knr-one-variable-decl SEMICOLON
1025 ( ,(semantic-expand-c-tag ,$1) )
1031 | PERIOD PERIOD PERIOD RPAREN
1032 (VARIABLE-TAG "..." "vararg" nil)
1044 | GREATER GREATER EQUAL
1072 | MINUS GREATER STAR
1089 | AMPERSAND AMPERSAND
1101 ;; HAT EQUAL seems to have a really unpleasant result and
1102 ;; breaks everything after it. Leave it at the end, though it
1103 ;; doesn't seem to work.
1110 : OPERATOR operatorsym
1113 ( EXPAND $1 function-pointer )
1119 : LPAREN STAR opt-symbol RPAREN
1120 ( (concat "*" ,(car $3)) )
1121 | LPAREN symbol RPAREN
1130 ;; Here is an annoying feature of C++ pure virtual methods
1131 | EQUAL ZERO SEMICOLON
1132 ( :pure-virtual-flag )
1138 : TRY opt-initializers BRACE_BLCK fun-try-several-catches
1142 fun-try-several-catches
1143 : CATCH PAREN_BLCK BRACE_BLCK fun-try-several-catches
1145 | CATCH BRACE_BLCK fun-try-several-catches
1153 ( EXPAND $1 type-cast-list )
1157 : open-paren typeformbase close-paren
1160 opt-brackets-after-symbol
1161 : brackets-after-symbol
1165 brackets-after-symbol
1170 multi-stage-dereference
1171 : namespace-symbol opt-brackets-after-symbol
1172 PERIOD multi-stage-dereference ;; method call
1173 | namespace-symbol opt-brackets-after-symbol
1174 MINUS GREATER multi-stage-dereference ;;method call
1175 | namespace-symbol opt-brackets-after-symbol
1176 PERIOD namespace-symbol opt-brackets-after-symbol
1177 | namespace-symbol opt-brackets-after-symbol
1178 MINUS GREATER namespace-symbol opt-brackets-after-symbol
1179 | namespace-symbol brackets-after-symbol
1184 ( (concat $1 (car $2)) )
1201 | AMPERSAND AMPERSAND
1209 ;; Use expression for parsing only. Don't actually return anything
1210 ;; for now. Hopefully we can fix this later.
1212 : unaryexpression QUESTION unaryexpression COLON unaryexpression
1213 ( (identity start) (identity end) )
1214 | unaryexpression expr-binop unaryexpression
1215 ( (identity start) (identity end) )
1217 ( (identity start) (identity end) )
1222 | multi-stage-dereference
1223 | NEW multi-stage-dereference
1224 | NEW builtintype-types semantic-list
1226 ;; Klaus Berndl: C/C++ allows sequences of strings which are
1227 ;; concatenated by the precompiler to one string
1229 | type-cast expression ;; A cast to some other type
1230 ;; Casting the results of one expression to something else.
1231 | semantic-list expression
1233 | expr-start expression