1 ;;; c.by -- LL grammar for C/C++ language specification
2 ;; Copyright (C) 1999-2014 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 <http://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> EQUAL "\\`[=]\\'"
68 %token <punctuation> LESS "\\`[<]\\'"
69 %token <punctuation> GREATER "\\`[>]\\'"
70 %token <punctuation> COMA "\\`[,]\\'"
71 %token <punctuation> TILDE "\\`[~]\\'"
72 %token <punctuation> MOD "\\`[%]\\'"
73 %token <punctuation> HAT "\\`\\^\\'"
74 %token <punctuation> OR "\\`[|]\\'"
75 %token <string> C "\"C\""
76 %token <string> CPP "\"C\\+\\+\""
77 %token <number> ZERO "^0$"
78 %token <symbol> RESTRICT "\\<\\(__\\)?restrict\\>"
79 %token <open-paren> LPAREN "("
80 %token <close-paren> RPAREN ")"
81 %token <open-paren> LBRACE "{"
82 %token <close-paren> RBRACE "}"
83 %token <semantic-list> BRACK_BLCK "\\[.*\\]$"
84 %token <semantic-list> PAREN_BLCK "^("
85 %token <semantic-list> BRACE_BLCK "^{"
86 %token <semantic-list> VOID_BLCK "^(void)$"
87 %token <semantic-list> PARENS "()"
88 %token <semantic-list> BRACKETS "\\[\\]"
90 %token EXTERN "extern"
91 %put EXTERN summary "Declaration Modifier: extern <type> <name> ..."
92 %token STATIC "static"
93 %put STATIC summary "Declaration Modifier: static <type> <name> ..."
95 %put CONST summary "Declaration Modifier: const <type> <name> ..."
96 %token VOLATILE "volatile"
97 %put VOLATILE summary "Declaration Modifier: volatile <type> <name> ..."
98 %token REGISTER "register"
99 %put REGISTER summary "Declaration Modifier: register <type> <name> ..."
100 %token SIGNED "signed"
101 %put SIGNED summary "Numeric Type Modifier: signed <numeric type> <name> ..."
102 %token UNSIGNED "unsigned"
103 %put UNSIGNED summary "Numeric Type Modifier: unsigned <numeric type> <name> ..."
105 %token INLINE "inline"
106 %put INLINE summary "Function Modifier: inline <return type> <name>(...) {...};"
107 %token VIRTUAL "virtual"
108 %put VIRTUAL summary "Method Modifier: virtual <type> <name>(...) ..."
109 %token MUTABLE "mutable"
110 %put MUTABLE summary "Member Declaration Modifier: mutable <type> <name> ..."
111 %token EXPLICIT "explicit"
112 %put EXPLICIT summary "Forbids implicit type conversion: explicit <constructor>"
114 %token STRUCT "struct"
115 %put STRUCT summary "Structure Type Declaration: struct [name] { ... };"
117 %put UNION summary "Union Type Declaration: union [name] { ... };"
119 %put ENUM summary "Enumeration Type Declaration: enum [name] { ... };"
120 %token TYPEDEF "typedef"
121 %put TYPEDEF summary "Arbitrary Type Declaration: typedef <typedeclaration> <name>;"
123 %put CLASS summary "Class Declaration: class <name>[:parents] { ... };"
124 %token TYPENAME "typename"
125 %put TYPENAME summary "typename is used to handle a qualified name as a typename;"
126 %token NAMESPACE "namespace"
127 %put NAMESPACE summary "Namespace Declaration: namespace <name> { ... };"
129 %put USING summary "using <namespace>;"
132 %put NEW summary "new <classname>();"
133 %token DELETE "delete"
134 %put DELETE summary "delete <object>;"
136 ;; Despite this, this parser can find templates by ignoring the TEMPLATE
137 ;; keyword, and finding the class/method being templatized.
138 %token TEMPLATE "template"
139 %put TEMPLATE summary "template <class TYPE ...> TYPE_OR_FUNCTION"
142 %put THROW summary "<type> <methoddef> (<method args>) throw (<exception>) ..."
143 %token REENTRANT "reentrant"
144 %put REENTRANT summary "<type> <methoddef> (<method args>) reentrant ..."
147 %put { TRY CATCH } summary "try { <body> } catch { <catch code> }"
149 ;; Leave these alone for now.
150 %token OPERATOR "operator"
151 %token PUBLIC "public"
152 %token PRIVATE "private"
153 %token PROTECTED "protected"
154 %token FRIEND "friend"
155 %put FRIEND summary "friend class <CLASSNAME>"
157 ;; These aren't used for parsing, but is a useful place to describe the keywords.
160 %put {IF ELSE} summary "if (<condition>) { code } [ else { code } ]"
164 %put DO summary " do { code } while (<condition>);"
165 %put WHILE summary "do { code } while (<condition>); or while (<condition>) { code };"
168 %put FOR summary "for(<init>; <condition>; <increment>) { code }"
170 %token SWITCH "switch"
172 %token DEFAULT "default"
173 %put {SWITCH CASE DEFAULT} summary
174 "switch (<variable>) { case <constvalue>: code; ... default: code; }"
176 %token RETURN "return"
177 %put RETURN summary "return <value>;"
180 %put BREAK summary "Non-local exit within a loop or switch (for, do/while, switch): break;"
181 %token CONTINUE "continue"
182 %put CONTINUE summary "Non-local continue within a loop (for, do/while): continue;"
184 %token SIZEOF "sizeof"
185 %put SIZEOF summary "Compile time macro: sizeof(<type or variable>) // size in bytes"
189 %put VOID summary "Built in typeless type: void"
191 %put CHAR summary "Integral Character Type: (0 to 256)"
192 %token WCHAR "wchar_t"
193 %put WCHAR summary "Wide Character Type"
195 %put SHORT summary "Integral Primitive Type: (-32768 to 32767)"
197 %put INT summary "Integral Primitive Type: (-2147483648 to 2147483647)"
199 %put LONG summary "Integral primitive type (-9223372036854775808 to 9223372036854775807)"
201 %put FLOAT summary "Primitive floating-point type (single-precision 32-bit IEEE 754)"
202 %token DOUBLE "double"
203 %put DOUBLE summary "Primitive floating-point type (double-precision 64-bit IEEE 754)"
205 %put BOOL summary "Primitive boolean type"
208 %token UNDERUNDERP "__P"
209 %put UNDERP summary "Common macro to eliminate prototype compatibility on some compilers"
210 %put UNDERUNDERP summary "Common macro to eliminate prototype compatibility on some compilers"
217 ;; TODO: Klaus Berndl: Is the define here necessary or even wrong?
218 ;; Is this part not already covered by macro??
228 | codeblock-var-or-fun
229 | type ;; type is less likely to be used here.
242 : EXTERN C semantic-list
243 ;; Extern C commands which contain a list need to have the
244 ;; entries of the list extracted, and spliced into the main
245 ;; list of entries. This must be done via the function
246 ;; that expands singular nonterminals, such as int x,y;
247 (TAG "C" 'extern :members (EXPANDFULL $3 extern-c-contents) )
248 | EXTERN CPP semantic-list
249 (TAG "C" 'extern :members (EXPANDFULL $3 extern-c-contents) )
251 ;; A plain extern "C" call should add something to the token,
252 ;; but just strip it from the buffer here for now.
260 (VARIABLE-TAG $1 nil nil :constant-flag t )
267 ;; This is used in struct parts.
270 (VARIABLE-TAG $1 nil nil :constant-flag t)
275 ;; In C++, structures can have the same things as classes.
276 ;; So delete this some day in the figure.
278 ;;structparts : semantic-list
279 ;; (EXPANDFULL $1 structsubparts)
282 ;;structsubparts : LBRACE
288 ;; ;; sometimes there are defines in structs.
293 (EXPANDFULL $1 classsubparts)
301 ;; @todo - support 'friend' construct.
307 | class-protection opt-symbol COLON
308 ;; For QT, they may put a `slot' keyword between the protection
309 ;; and the COLON. @todo - Have the QT stuff use macros.
310 (TAG (car $1) 'label)
313 (TAG (car $2) 'friend)
314 | FRIEND CLASS symbol
323 : COLON class-parents opt-template-specifier
330 : opt-class-protection opt-class-declmods namespace-symbol
331 (TYPE-TAG (car $3) "class" nil nil :protection (car $1))
332 | opt-class-declmods opt-class-protection namespace-symbol
333 (TYPE-TAG (car $3) "class" nil nil :protection (car $2))
337 : one-class-parent COMA class-parents
344 : class-declmods opt-class-declmods
362 | ;;EMPTY - Same as private
368 (EXPANDFULL $1 namespacesubparts)
379 | class-protection COLON
380 (TAG (car $1) 'label)
381 ;; In C++, this label in a classsubpart represents
382 ;; PUBLIC or PRIVATE bits. Ignore them for now.
385 ;; Includes inside namespaces
387 (TAG $1 'include :inside-ns t)
393 (EXPANDFULL $1 enumsubparts)
398 (VARIABLE-TAG $1 "int" (car $2) :constant-flag t )
414 : struct-or-class opt-class opt-name opt-template-specifier
415 opt-class-parents semantic-list
416 (TYPE-TAG (car $3) (car $1)
417 (let ((semantic-c-classname (cons (car ,$3) (car ,$1))))
418 (EXPANDFULL $6 classsubparts))
420 :template-specifier $4
422 | struct-or-class opt-class opt-name opt-template-specifier
424 (TYPE-TAG (car $3) (car $1) nil $5
425 :template-specifier $4
428 | UNION opt-class opt-name unionparts
429 (TYPE-TAG (car $3) $1 $4 nil
431 | ENUM opt-class opt-name enumparts
432 (TYPE-TAG (car $3) $1 $4 nil
434 ;; Klaus Berndl: a typedef can be a typeformbase with all this
436 | TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list
437 ;;;; We put the type this typedef renames into PARENT
438 ;;;; but will move it in the expand function.
439 (TYPE-TAG $5 $1 nil (list $3) )
443 : typedefname COMA typedef-symbol-list
449 ;; TODO: Klaus Berndl: symbol -> namespace-symbol?! Answer: Probably
450 ;; symbol is correct here!
452 : opt-stars symbol opt-bits opt-array
462 : typesimple SEMICOLON
464 ;; named namespaces like "namespace XXX {"
465 | NAMESPACE symbol namespaceparts
466 (TYPE-TAG $2 $1 $3 nil )
467 ;; unnamed namespaces like "namespace {"
468 | NAMESPACE namespaceparts
469 (TYPE-TAG "unnamed" $1 $2 nil )
470 ;; David Engster: namespace alias like "namespace foo = bar;"
471 | NAMESPACE symbol EQUAL typeformbase SEMICOLON
472 (TYPE-TAG $2 $1 (list (TYPE-TAG (car $4) $1 nil nil)) nil :kind 'alias )
475 ;; Klaus Berndl: We must parse "using namespace XXX" too
477 ;; Using is vaguely like an include statement in the named portions
478 ;; of the code. We should probably specify a new token type for this.
481 : USING usingname SEMICOLON
482 (TAG (car $2) 'using :type ,$2 )
485 ;; Jan Moringen: Differentiate between 'using' and 'using namespace'
486 ;; Adapted to creating type tags by EML.
489 (TYPE-TAG (car $1) "class" nil nil :prototype t)
490 | NAMESPACE typeformbase
491 (TYPE-TAG (car $2) "namespace" nil nil :prototype t)
495 : TEMPLATE template-specifier opt-friend template-definition
496 ( ,(semantic-c-reconstitute-template $4 ,$2) )
504 opt-template-specifier
512 : LESS template-specifier-types GREATER
516 template-specifier-types
517 : template-var template-specifier-type-list
522 template-specifier-type-list
523 : COMA template-specifier-types
530 ;; : template-type opt-stars opt-template-equal
531 ;; ( ,(cons (concat (car $1) (make-string (car ,$2) ?*))
533 ;; ;; Klaus Berndl: for template-types the template-var can also be
534 ;; ;; literals or constants. Example: map<ClassX, ClassY, 10>
535 ;; ;; map_size10_var; This parses also template<class T, 0> which is
536 ;; ;; nonsense but who cares....
545 ;; Klaus Berndl: The following handles all template-vars of
546 ;; template-definitions
547 template-type opt-template-equal
548 ( ,(cons (car $1) (cdr $1)) )
549 ;; Klaus Berndl: for template-types the template-var can also be
550 ;; literals or constants.
551 ;; Example: map<ClassX, ClassY, 10> map_size10_var; This parses also
552 ;; template<class T, 0> which is nonsense but who cares....
557 ;; Klaus Berndl: In template-types arguments can be any symbols with
558 ;; optional address-operator (&) and optional dereferencing operator
559 ;; (*). Example map<ClassX, ClassY, *size_var_ptr> sized_map_var.
560 | opt-stars opt-ref namespace-symbol
562 ;; Some code can compile down into a number, but starts out as an
563 ;; expression, such as "sizeof(a)", or (sizeof(a)/sizeof(b))
566 | SIZEOF semantic-list
571 : EQUAL symbol LESS template-specifier-types GREATER
581 (TYPE-TAG $2 "class" nil nil )
583 (TYPE-TAG $2 "struct" nil nil )
584 ;; TODO: Klaus Berndl: For the moment it is ok, that we parse the C++
585 ;; keyword typename as a class....
587 (TYPE-TAG $2 "class" nil nil)
588 ;; Klaus Berndl: template-types can be all flavors of variable-args
589 ;; but here the argument is ignored, only the type stuff is needed.
590 | declmods typeformbase cv-declmods opt-stars
591 opt-ref variablearg-opt-name
592 (TYPE-TAG (car $2) nil nil nil
593 :constant-flag (if (member "const" (append $1 $3)) t nil)
594 :typemodifiers (delete "const" (append $1 $3))
608 : STAR opt-starmod opt-stars
615 : STARMOD opt-starmod
616 ( ,(cons (,car ,$1) $2) )
627 ( ,(cons ,(car ,$1) $2 ) )
638 ;; Klaus Berndl: IMHO signed and unsigned are not decl-modes but
639 ;; these are only valid for some buildin-types like short, int
640 ;; etc... whereas "real" declmods are valid for all types, buildin
641 ;; and user-defined! SIGNED UNSIGNED
645 ;; Klaus Berndl: There can be a few cases where TYPENAME is not
646 ;; allowed in C++-syntax but better than not recognizing the allowed
650 ;; This is a hack in case we are in a class.
667 : CVDECLMOD cv-declmods
668 ( ,(cons ,(car ,$1) $2 ) )
680 ;; C++: A type can be modified into a reference by "&"
692 (TYPE-TAG $2 $1 nil nil )
694 (TYPE-TAG $2 $1 nil nil )
696 (TYPE-TAG $2 $1 nil nil )
699 | symbol template-specifier
700 (TYPE-TAG $1 "class" nil nil :template-specifier $2)
701 ;;| namespace-symbol opt-stars opt-template-specifier
702 ;;| namespace-symbol opt-template-specifier
703 | namespace-symbol-for-typeformbase opt-template-specifier
704 (TYPE-TAG (car $1) "class" nil nil
705 :template-specifier $2)
715 ;; Klaus Berndl: builtintype-types was builtintype
719 ;; Klaus Berndl: Added WCHAR
722 ( (concat $1 " " $2) )
726 ( (concat $1 " " $2) )
731 ( (concat $1 " " $2) )
732 ;; TODO: Klaus Berndl: Is there a long long, i think so?!
734 ( (concat $1 " " $2) )
739 : signedmod builtintype-types
740 ( (concat (car $1) " " (car $2)) )
743 ;; Klaus Berndl: unsigned is synonym for unsigned int and signed for
744 ;; signed int. To make this confusing stuff clear we add here the
747 ( (concat (car $1) " int") )
750 ;; Klaus Berndl: This parses also nonsense like "const volatile int
751 ;; const volatile const const volatile a ..." but IMHO nobody writes
752 ;; such code. Normally we should define a rule like typeformbase-mode
753 ;; which exactly defines the different allowed cases and combinations
754 ;; of declmods (minus the CVDECLMOD) typeformbase and cv-declmods so
755 ;; we could recognize more invalid code but IMHO this is not worth the
758 : declmods typeformbase declmods
759 opt-ref var-or-func-decl
760 ( ,(semantic-c-reconstitute-token ,$5 $1 $2 ) )
764 : codeblock-var-or-fun
766 ;; it is possible for a function to not have a type, and
767 ;; it is then assumed to be an int. How annoying.
768 ;; In C++, this could be a constructor or a destructor.
769 ;; Even more annoying. Only ever do this for regular
770 ;; top-level items. Ignore this problem in code blocks
771 ;; so that we don't have to deal with regular code
772 ;; being erroneously converted into types.
773 | declmods var-or-func-decl
774 ( ,(semantic-c-reconstitute-token ,$2 $1 nil ) )
785 : opt-stars opt-class opt-destructor functionname
786 opt-template-specifier
789 opt-post-fcn-modifiers
794 ;; Extra stuff goes in here.
795 ;; Continue with the stuff we found in
797 $2 $3 $7 $9 $8 ,$1 ,$11 $5 ,$10)
798 | opt-stars opt-class opt-destructor functionname
799 opt-template-specifier
801 ;; arg-list - - ini this case, a try implies a fcn.
802 opt-post-fcn-modifiers
807 ;; Extra stuff goes in here.
808 ;; Continue with the stuff we found in
810 $2 $3 nil $8 $7 ,$1 ,$10 $5 ,$9)
814 : varnamelist SEMICOLON
826 ;; Klaus Berndl: symbol -> namespace-symbol
828 : COLON namespace-symbol semantic-list opt-initializers
829 | COMA namespace-symbol semantic-list opt-initializers
833 opt-post-fcn-modifiers
834 : post-fcn-modifiers opt-post-fcn-modifiers
846 : THROW semantic-list
847 ( EXPAND $2 throw-exception-list )
851 ;; Is this true? I don't actually know.
853 : namespace-symbol COMA throw-exception-list
854 ( ,(cons (car $1) $3) )
855 | namespace-symbol RPAREN
859 | LPAREN throw-exception-list
873 : BRACK_BLCK opt-array
874 ;; Eventually we want to replace the 1 below with a size
876 ( (cons 1 (car ,$2) ) )
893 ;; Klaus Berndl: symbol -> namespace-symbol?! I think so. Can be that
894 ;; then also some invalid C++-syntax is parsed but this is better than
895 ;; not parsing valid syntax.
897 : opt-stars opt-restrict namespace-symbol opt-bits opt-array
901 ;; I should store more in this def, but leave it simple for now.
902 ;; Klaus Berndl: const and volatile can be written after the type!
904 : declmods typeformbase cv-declmods opt-ref variablearg-opt-name opt-assign
905 ( VARIABLE-TAG (list (append $5 ,$6)) $2 nil
906 :constant-flag (if (member "const" (append $1 $3)) t nil)
907 :typemodifiers (delete "const" (append $1 $3))
915 | semantic-list arg-list
916 ( (car ( EXPAND $1 function-pointer )) $2)
917 ;; Klaus Berndl: This allows variableargs without a arg-name being
918 ;; parsed correct even if there several pointers (*)
920 ( "" ,$1 nil nil nil )
923 varname-opt-initializer
930 : opt-ref varname varname-opt-initializer COMA varnamelist
931 ( ,(cons (append $2 $3) $5) )
932 | opt-ref varname varname-opt-initializer
936 ;; Klaus Berndl: Is necessary to parse stuff like
937 ;; class list_of_facts : public list<fact>, public entity
939 ;; list <shared_ptr<item> >::const_iterator l;
940 ;; Parses also invalid(?) and senseless(?) c++-syntax like
941 ;; symbol<template-spec>::symbol1<template-spec1>::test_iterator
942 ;; but better parsing too much than to less
944 : symbol opt-template-specifier COLON COLON namespace-symbol
945 ( (concat $1 "::" (car $5)) )
946 | symbol opt-template-specifier
950 ;; Don't pull an optional template specifier at the end of the
951 ;; namespace symbol so that it can be picked up by the type.
952 namespace-symbol-for-typeformbase
953 : symbol opt-template-specifier COLON COLON namespace-symbol-for-typeformbase
954 ( (concat $1 "::" (car $5)) )
959 ;; : symbol COLON COLON namespace-symbol
960 ;; ( (concat $1 "::" (car $4)) )
966 : symbol COLON COLON namespace-opt-class
967 ( (concat $1 "::" (car $4)) )
968 ;; Klaus Berndl: We must recognize template-specifiers here so we can
969 ;; parse correctly the method-implementations of template-classes
970 ;; outside the template-class-declaration Example:
971 ;; TemplateClass1<T>::method_1(...)
972 | symbol opt-template-specifier COLON COLON
976 ;; Klaus Berndl: The opt-class of a func-decl must be able to
977 ;; recognize opt-classes with namespaces, e.g.
978 ;; Test1::Test2::classname::
980 : namespace-opt-class
994 : PAREN_BLCK knr-arguments
997 (EXPANDFULL $1 arg-sub-list)
1003 : varname COMA knr-varnamelist
1010 knr-one-variable-decl
1011 : declmods typeformbase cv-declmods knr-varnamelist
1012 ( VARIABLE-TAG (nreverse $4) $2 nil
1013 :constant-flag (if (member "const" (append $3)) t nil)
1014 :typemodifiers (delete "const" $3)
1019 : knr-one-variable-decl SEMICOLON knr-arguments
1020 ( ,(append (semantic-expand-c-tag ,$1) ,$3) )
1021 | knr-one-variable-decl SEMICOLON
1022 ( ,(semantic-expand-c-tag ,$1) )
1028 | PERIOD PERIOD PERIOD RPAREN
1029 (VARIABLE-TAG "..." "vararg" nil)
1041 | GREATER GREATER EQUAL
1069 | MINUS GREATER STAR
1086 | AMPERSAND AMPERSAND
1098 ;; HAT EQUAL seems to have a really unpleasant result and
1099 ;; breaks everything after it. Leave it at the end, though it
1100 ;; doesn't seem to work.
1107 : OPERATOR operatorsym
1110 ( EXPAND $1 function-pointer )
1116 : LPAREN STAR opt-symbol RPAREN
1117 ( (concat "*" ,(car $3)) )
1118 | LPAREN symbol RPAREN
1127 ;; Here is an annoying feature of C++ pure virtual methods
1128 | EQUAL ZERO SEMICOLON
1129 ( :pure-virtual-flag )
1135 : TRY opt-initializers BRACE_BLCK fun-try-several-catches
1139 fun-try-several-catches
1140 : CATCH PAREN_BLCK BRACE_BLCK fun-try-several-catches
1142 | CATCH BRACE_BLCK fun-try-several-catches
1150 ( EXPAND $1 type-cast-list )
1154 : open-paren typeformbase close-paren
1157 opt-brackets-after-symbol
1158 : brackets-after-symbol
1162 brackets-after-symbol
1167 multi-stage-dereference
1168 : namespace-symbol opt-brackets-after-symbol
1169 PERIOD multi-stage-dereference ;; method call
1170 | namespace-symbol opt-brackets-after-symbol
1171 MINUS GREATER multi-stage-dereference ;;method call
1172 | namespace-symbol opt-brackets-after-symbol
1173 PERIOD namespace-symbol opt-brackets-after-symbol
1174 | namespace-symbol opt-brackets-after-symbol
1175 MINUS GREATER namespace-symbol opt-brackets-after-symbol
1176 | namespace-symbol brackets-after-symbol
1181 ( (concat $1 (car $2)) )
1198 | AMPERSAND AMPERSAND
1206 ;; Use expression for parsing only. Don't actually return anything
1207 ;; for now. Hopefully we can fix this later.
1209 : unaryexpression expr-binop unaryexpression
1210 ( (identity start) (identity end) )
1212 ( (identity start) (identity end) )
1217 | multi-stage-dereference
1218 | NEW multi-stage-dereference
1219 | NEW builtintype-types semantic-list
1221 ;; Klaus Berndl: C/C++ allows sequences of strings which are
1222 ;; concatenated by the precompiler to one string
1224 | type-cast expression ;; A cast to some other type
1225 ;; Casting the results of one expression to something else.
1226 | semantic-list expression
1228 | expr-start expression