From aa489359655148ea37a432ec43f8bde854da6847 Mon Sep 17 00:00:00 2001 From: François Pottier Date: Tue, 24 Nov 2015 09:00:39 +0100 Subject: A simplification in the grammar, leading to fewer states in the automaton and merging two error states into one. There should be no observable change. --- cparser/handcrafted.messages | 14 +------------- cparser/pre_parser.mly | 9 +++------ 2 files changed, 4 insertions(+), 19 deletions(-) (limited to 'cparser') diff --git a/cparser/handcrafted.messages b/cparser/handcrafted.messages index dc368fbf..9f8f2694 100644 --- a/cparser/handcrafted.messages +++ b/cparser/handcrafted.messages @@ -1843,17 +1843,6 @@ is expected. # ------------------------------------------------------------------------------ -translation_unit_file: SEMICOLON XOR_ASSIGN -## -## Ends in an error in state: 399. -## -## translation_unit -> translation_unit . external_declaration [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PRAGMA PACKED LONG INT INLINE FLOAT EXTERN EOF ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] -## translation_unit -> translation_unit . SEMICOLON [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PRAGMA PACKED LONG INT INLINE FLOAT EXTERN EOF ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] -## translation_unit_file -> translation_unit . EOF [ # ] -## -## The known suffix of the stack is as follows: -## translation_unit -## translation_unit_file: XOR_ASSIGN ## ## Ends in an error in state: 0. @@ -1863,9 +1852,8 @@ translation_unit_file: XOR_ASSIGN ## The known suffix of the stack is as follows: ## ## -# The king of all syntax errors: an error in the initial state. -# Anyway, we are at the toplevel. +# We are at the toplevel. # clang and gcc want an identifier or an opening parenthesis, which is way incomplete. diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index d217a7a4..d6a4a21c 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -873,18 +873,15 @@ asm_flags: {} translation_unit_file: -| translation_unit EOF -| EOF +| translation_item* EOF {} -translation_unit: +translation_item: | external_declaration -| translation_unit external_declaration -| translation_unit SEMICOLON | SEMICOLON {} -external_declaration: +%inline external_declaration: | function_definition | declaration(external_declaration) | PRAGMA -- cgit