From: Eric Ludlam Date: Sun, 14 Feb 2016 15:26:36 +0000 (-0500) Subject: semantic: C grammar fixes X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fb127f25742c949dbf287a49f26cf8386c08dbf3;p=emacs.git semantic: C grammar fixes * admin/grammars/c.by (constexpr, noexcept): New. (cvdeclmod, metadeclmod,post-fcn-modifiers): Add ocurences of above. (expr-start): Allow to be empty. (expression): Delete - simplify to just find unaryexpression followed by more. (opt-more-expression): New - has specifics originally in expression. (unaryexpression): Simplified a couple bits around lists and unary expressions. --- diff --git a/admin/grammars/c.by b/admin/grammars/c.by index 38a33f94593..7488c759b88 100644 --- a/admin/grammars/c.by +++ b/admin/grammars/c.by @@ -94,6 +94,7 @@ %put STATIC summary "Declaration Modifier: static ..." %token CONST "const" %put CONST summary "Declaration Modifier: const ..." +%token CONSTEXPR "constexpr" %token VOLATILE "volatile" %put VOLATILE summary "Declaration Modifier: volatile ..." %token REGISTER "register" @@ -150,6 +151,7 @@ %token TRY "try" %token CATCH "catch" %put { TRY CATCH } summary "try { } catch { }" +%token NOEXCEPT "noexcept" ;; Leave these alone for now. %token OPERATOR "operator" @@ -680,6 +682,7 @@ metadeclmod CVDECLMOD : CONST + | CONSTEXPR | VOLATILE ; @@ -695,6 +698,7 @@ cv-declmods METADECLMOD : VIRTUAL | MUTABLE + | EXPLICIT ; ;; C++: A type can be modified into a reference by "&" @@ -858,6 +862,7 @@ post-fcn-modifiers | CONST | OVERRIDE | FINAL + | NOEXCEPT ; opt-throw @@ -1203,6 +1208,7 @@ expr-start | PLUS | STAR | AMPERSAND + | ;; EMPTY ; expr-binop @@ -1221,12 +1227,14 @@ expr-binop ;; Use expression for parsing only. Don't actually return anything ;; for now. Hopefully we can fix this later. expression - : unaryexpression QUESTION unaryexpression COLON unaryexpression - ( (identity start) (identity end) ) - | unaryexpression expr-binop unaryexpression - ( (identity start) (identity end) ) - | unaryexpression - ( (identity start) (identity end) ) + : expr-start unaryexpression opt-more-expression + ( (identity start) (- end 1) ) + ; + +opt-more-expression + : QUESTION unaryexpression COLON unaryexpression + | expr-binop unaryexpression + | ;; EMPTY ; unaryexpression @@ -1240,9 +1248,9 @@ unaryexpression | string-seq | type-cast expression ;; A cast to some other type ;; Casting the results of one expression to something else. - | semantic-list expression + | semantic-list unaryexpression | semantic-list - | expr-start expression + ;;| expr-start expression ; ;;; c.by ends here