-/* Handle the semantics of an action specially, with a mid-rule
- action, so that grammar_current_rule_action_append is invoked
- immediately after the braced code is read by the scanner.
-
- This implementation relies on the LALR(1) parsing algorithm.
- If grammar_current_rule_action_append were executed in a normal
- action for this rule, then when the input grammar contains two
- successive actions, the scanner would have to read both actions
- before reducing this rule. That wouldn't work, since the scanner
- relies on all preceding input actions being processed by
- grammar_current_rule_action_append before it scans the next
- action. */
-action:
- { grammar_current_rule_action_append (last_string, last_braced_code_loc); }
- BRACED_CODE
+
+/*---------------------------.
+| variable and content.opt. |
+`---------------------------*/
+
+/* The STRING form of variable is deprecated and is not M4-friendly.
+ For example, M4 fails for `%define "[" "value"'. */
+variable:
+ ID
+| STRING { $$ = uniqstr_new ($1); }
+;
+
+/* Some content or empty by default. */
+content.opt:
+ /* Nothing. */ { $$ = ""; }
+| STRING
+;
+
+
+/*------------.
+| braceless. |
+`------------*/
+
+braceless:
+ "{...}"
+ {
+ code_props plain_code;
+ $1[strlen ($1) - 1] = '\n';
+ code_props_plain_init (&plain_code, $1+1, @1);
+ code_props_translate_code (&plain_code);
+ gram_scanner_last_string_free ();
+ $$ = plain_code.code;
+ }
+;
+
+
+/*--------------.
+| Identifiers. |
+`--------------*/
+
+/* Identifiers are returned as uniqstr values by the scanner.
+ Depending on their use, we may need to make them genuine symbols. */
+
+id:
+ ID
+ { $$ = symbol_from_uniqstr ($1, @1); }
+| CHAR
+ {
+ $$ = symbol_get (char_name ($1), @1);
+ symbol_class_set ($$, token_sym, @1, false);
+ symbol_user_token_number_set ($$, $1, @1);
+ }
+;
+
+id_colon:
+ ID_COLON { $$ = symbol_from_uniqstr ($1, @1); }
+;
+
+
+symbol:
+ id
+| string_as_id