On 02.02.2021 09:22, RĂ©mi Bernon wrote:
And make qualified name lookup more robust:
Either parse a non-qualified name directly from the current (or global) namespace, or start parsing a qualified name.
Qualified name parsing uses the lookup namespace stack only to find types or sub-namespaces.
I think it's a step in the right direction, but things like find_qualified_type_or_error() resetting lookup_namespace as a side effect does not look appealing.
I wonder if we could entirely get rid of global lookup_namespace variable. As far as parser is considered, namespace_pfx could just return a namespace type that we could use to find types. That leaves us with is_type() and is_namespace(), which are used in lexer. I'd say that it's not a job of lexer to distinguish between an identifier and a known type. Maybe we could just get rid of aNAMESPACE and aKNOWNTYPE and deal with that in parser instead?
Thanks,
Jacek