summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/grammar.y28
1 files changed, 17 insertions, 11 deletions
diff --git a/tools/d2c/grammar.y b/tools/d2c/grammar.y
index 02b2671..f0c1779 100644
--- a/tools/d2c/grammar.y
+++ b/tools/d2c/grammar.y
@@ -175,28 +175,31 @@ name : COPYRIGHT TITLE INS_NAME { save_notes_for_coder(coder
encodings : /* empty */
| encoding encodings
-encoding : ENCODING TYPE NUMBER format_content { push_encoding_spec(coder, $2, $3); }
- | ENCODING format_content { push_encoding_spec(coder, NULL, -1); }
- | ENCODING TYPE NUMBER content { push_encoding_spec(coder, $2, $3); }
+encoding : ENCODING TYPE NUMBER format_encoding { push_encoding_spec(coder, $2, $3); }
+ | ENCODING format_encoding { push_encoding_spec(coder, NULL, -1); }
+ | ENCODING TYPE NUMBER raw_encoding { push_encoding_spec(coder, $2, $3); }
/* Définitions à l'aide d'un format défini */
-format_content : /* empty */
- | format format_content
+format_encoding : format format_content
format : FORMAT RAW_LINE { handle_coder_format(coder, $2); }
+format_content : /* empty */
+ | hooks format_content
+ | rules format_content
+
/* Définitions à l'aide de données brutes */
+raw_encoding : bitfield raw_content
-content : /* empty */
- | bitfield content
- | syntax content
- | conversions content
- | hooks content
- | rules content
+raw_content : /* empty */
+ | syntax raw_content
+ | conversions raw_content
+ | hooks raw_content
+ | rules raw_content
bitfield : HALF RAW_LINE { handle_coder_bits(coder, 16, $2); }
| WORD RAW_LINE { handle_coder_bits(coder, 32, $2); }
@@ -205,6 +208,9 @@ syntax : SYNTAX RAW_LINE { handle_coder_syntax(coder, $2); }
conversions : CONV RAW_BLOCK { handle_coder_conversions(coder, $2); }
+
+/* Définitions communes */
+
hooks : HOOKS RAW_BLOCK { handle_coder_hooks(coder, $2); }
rules : RULES RAW_BLOCK { handle_coder_rules(coder, $2); }