public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-cpparser-branch: * cparser.c (cp_parse_postfix_expression): Remove TTYPE_CLOSE_PAREN case. (cp_do_parse): Remove. (c_parse): Call cp_parse_expression instead of cp_do_parse. If we didn't parse all tokens, issue an error.
@ 2010-10-27 16:48 kseitz
0 siblings, 0 replies; only message in thread
From: kseitz @ 2010-10-27 16:48 UTC (permalink / raw)
To: archer-commits
The branch, archer-cpparser-branch has been updated
via a61801b679a373d2b1862515282a96e616de13bd (commit)
from b1461114cec890ec5e743449790ed68767a883da (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit a61801b679a373d2b1862515282a96e616de13bd
Author: keiths <keiths@redhat.com>
Date: Wed Oct 27 09:30:25 2010 -0700
* cparser.c (cp_parse_postfix_expression): Remove
TTYPE_CLOSE_PAREN case.
(cp_do_parse): Remove.
(c_parse): Call cp_parse_expression instead of
cp_do_parse.
If we didn't parse all tokens, issue an error.
-----------------------------------------------------------------------
Summary of changes:
gdb/cparser.c | 77 +++++++++++++++++++++++++++-----------------------------
1 files changed, 37 insertions(+), 40 deletions(-)
First 500 lines of diff:
diff --git a/gdb/cparser.c b/gdb/cparser.c
index 9e7b7bb..256d0e5 100644
--- a/gdb/cparser.c
+++ b/gdb/cparser.c
@@ -791,7 +791,8 @@ cp_parse_error_occurred (cp_parser *parser)
/* Stop parsing tentatively. If a parse error has occurred, restore the
token stream. Otherwise, commit to the tokens we have consumed.
-Returns non-zero if no error occured; 0 otherwise. */
+
+ Returns non-zero if no error occured; 0 otherwise. */
static int
cp_parse_definitely (cp_parser *parser)
@@ -2696,7 +2697,30 @@ cp_parse_elaborated_type_specifier (cp_parser *parser)
return type;
}
-/* */
+/* Parse a type-specifier.
+
+ type-specifier:
+ simple-type-specifier
+ class-specifier
+ enum-specifier
+ elaborated-type-specifier
+ cv-qualifier
+
+ Returns a representation of the type-specifier.
+
+ The parser flags FLAGS is used to control type-specifier parsing.
+
+ If IS_DECLARATION is TRUE, then this type-specifier is appearing
+ in a decl-specifier-seq.
+ If DECLARES_CLASS_OR_ENUM is non-NULL, and the type-specifier is a
+ class-specifier, enum-specifier, or elaborated-type-specifier, then
+ *DECLARES_CLASS_OR_ENUM is set to a nonzero value. The value is 1
+ if a type is declared; 2 if it is defined. Otherwise, it is set to
+ zero.
+
+ If IS_CV_QUALIFIER is non-NULL, and the type-specifier is a
+ cv-qualifier, then IS_CV_QUALIFIER is set to TRUE. Otherwise, it
+ is set to FALSE. */
static struct type *
cp_parse_type_specifier (cp_parser *parser, cp_parser_flags flags,
@@ -2727,8 +2751,6 @@ cp_parse_type_specifier (cp_parser *parser, cp_parser_flags flags,
case KEYWORD_STRUCT:
case KEYWORD_UNION:
case KEYWORD_ENUM:
- /* Fall through */
- elaborated_type_specifier:
/* We're declaring (not defining) a class or enum. */
if (declares_class_or_enum)
*declares_class_or_enum = 1;
@@ -2862,11 +2884,6 @@ cp_parse_postfix_expression (cp_parser *parser, int address_p, int cast_p)
case TTYPE_OPEN_PAREN:
break;
- case TTYPE_CLOSE_PAREN:
- free_expression_chain (expr);
- error (_("Junk at the end of the arguments."));
- break;
-
case TTYPE_DOT:
case TTYPE_DEREF:
break;
@@ -3114,6 +3131,9 @@ cp_parse_type_id_1 (cp_parser *parser, int is_template_arg,
cp_decl_specifier_seq type_specifier_seq;
cp_parse_type_specifier_seq (parser, /*is_declaration=*/0,
is_trailing_return, &type_specifier_seq);
+
+ /* need the abstract-declarator stuff, which includes ptr-operator
+ and similar. */
return type_specifier_seq.type;
}
@@ -3276,32 +3296,6 @@ cp_cast_expression (cp_parser *parser, int address_p, int cast_p)
return cp_parse_unary_expression (parser, address_p, cast_p);
}
-static cp_expression *
-cp_do_parse (cp_parser *parser)
-{
- cp_expression *result = NULL;
-
- while (1)
- {
- cp_token *token = cp_lexer_peek_token (parser->lexer);
- if (cp_is_eof_token (token))
- break;
-
- /* Parse the expression. */
- if (result == NULL)
- result = cp_parse_expression (parser, /*cast_p=*/0);
- else
- {
- cp_expression *expr;
- expr = cp_parse_expression (parser, /*cast_p=*/0);
- cp_expression_append_chain (result, expr);
- free_expression_chain (expr);
- }
- }
-
- return result;
-}
-
\f
static void
@@ -3692,12 +3686,15 @@ c_parse (void)
if (parser_debug)
_cp_dump_token_stream (parser->lexer);
- /* This is not quite correct... We'd actually like to base this
- on the tokens that were consumed. !!FIXME!! */
- lexptr += parser->lexer->buffer.cur - start;
-
/* Parse input and reset global variables */
- expr = cp_do_parse (parser);
+ expr = cp_parse_expression (parser, /*cast_p=*/0);
+
+ if (!cp_is_eof_token (cp_lexer_peek_token (parser->lexer)))
+ {
+ free_expression_chain (expr);
+ error (_("Junk at end of expression"));
+ }
+
xfree (expout);
expout = expr->exp;
expout_size = expr->size;
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-27 16:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 16:48 [SCM] archer-cpparser-branch: * cparser.c (cp_parse_postfix_expression): Remove TTYPE_CLOSE_PAREN case. (cp_do_parse): Remove. (c_parse): Call cp_parse_expression instead of cp_do_parse. If we didn't parse all tokens, issue an error kseitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).