From: Jean Privat Date: Thu, 9 Feb 2017 17:05:13 +0000 (-0500) Subject: nitc: add ANode::is_structural X-Git-Url: http://nitlanguage.org nitc: add ANode::is_structural Signed-off-by: Jean Privat --- 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`