From 90a458888afab50476005e9b2bd01940ef7f7a83 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 9 Feb 2017 12:05:13 -0500 Subject: [PATCH] nitc: add ANode::is_structural Signed-off-by: Jean Privat --- src/parser/parser_nodes.nit | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parser/parser_nodes.nit b/src/parser/parser_nodes.nit index 261694a..b8d715d 100644 --- a/src/parser/parser_nodes.nit +++ b/src/parser/parser_nodes.nit @@ -34,6 +34,9 @@ abstract class ANode sys.stderr.write "{hot_location} {self.class_name}: {message}\n{hot_location.colored_line("0;32")}\n" end + # Is `self` a token or a pure-structural production like `AQId`? + fun is_structural: Bool do return false + # Write the subtree on stdout. # See `ASTDump` fun dump_tree @@ -331,6 +334,8 @@ abstract class Token # See `blank_before` to get the whitespace that separate tokens. var is_loose = false + redef fun is_structural do return true + # Loose tokens that precede `self`. # # These tokens start the line or belong to a line with only loose tokens. @@ -1667,6 +1672,8 @@ class AQid # The final identifier var n_id: TId is writable, noinit + + redef fun is_structural do return true end # A potentially qualified class identifier `foo::bar::Baz` @@ -1677,6 +1684,8 @@ class AQclassid # The final identifier var n_id: TClassid is writable, noinit + + redef fun is_structural do return true end # A signature in a method definition. eg `(x,y:X,z:Z):T` -- 1.7.9.5