polystat / odin

Object Dependency Inspector
10 stars 2 forks source link

Introducing support for imports without the alias #44

Closed Leosimetti closed 2 years ago

Leosimetti commented 2 years ago

In this PR, imports refer to such constructs in EO:

+alias print org.eolang.txt.sprintf

or

+alias org.eolang.txt.sprintf

The functionality of the following modules has been updated to support imports without aliases:

1. Parser

Now can identify imporys without aliases. For example, "+alias org.eolang.txt.sprintf".

2. AST

The ast node EOAliasMeta has been changed to

sealed case class EOAliasMeta(
alias: Option[String],
src: NonEmptyList[String],
) extends EOMeta

3. Pretty-printer

Now supports pretty-printing of import without aliases like "+alias org.eolang.txt.sprintf".

4. Context (setting locators)

Meta-aliases are added to the initial context that the algorithm references to get locator information. Some common imported keywords were removed from predef (EO keywords that are recognized when setting locators).

5. Tests

Testcases related to aliases in Parser were updated according to the made changes. Added testcases for setting locators in the presence of EO-keywords and aliases.

This PR closes #15