init
do
- build_reduce_table
+ self.reduce_table = once build_reduce_table
end
# Do a transition in the automata
end
private var reduce_table: Array[ReduceAction] is noinit
- private fun build_reduce_table is abstract
+ private fun build_reduce_table: Array[ReduceAction] is abstract
end
redef class Prod
end
var goto: Int
end
+
+redef class AExpr
+
+ # Get `self` as a single identifier.
+ # Return null if not a single identifier.
+ fun as_id: nullable String
+ do
+ if self isa AMethidExpr then
+ return self.collect_text
+ end
+ if not self isa ACallExpr then return null
+ if not self.n_expr isa AImplicitSelfExpr then return null
+ if not self.n_args.n_exprs.is_empty then return null
+ return self.n_qid.n_id.text
+ end
+end