RenamesFileParser

class RenamesFileParser constructor(reader: Reader, roots: ModuleRoots)

A RenamesFileParser parses a file of Avail module renaming rules and answers a map.

The format of the renames file is specified by the following simple grammar:

renamesFile ::= renameRule* ;
renameRule ::= quotedModulePath "→" quotedModulePath ;
quotedModulePath ::= '"' modulePath '"' ;
modulePath ::= moduleId ++ "/" ;
moduleId ::= [^/"]+ ;

Conceptually the renames file establishes a set of module reference renaming rules. On the left-hand side of a rule is a fully-qualified module reference (quotedModulePath) of the form "/R/X/.../Y/Z", where R is a root name referring to a vendor, X is a public package provided by the vendor, Y is a package recursively within module group X, and Z is a local module name. On the right-hand side of a rule is another module reference of the form "/Q/A/.../B/C", where Q is a root name referring to a vendor, A is a public package provided by the vendor, B is a package recursively within module group A, and C is a local module name.

Note that some operating systems may have difficulty resolving certain moduleIds if they contain arbitrary Unicode characters.

Author

Todd L Smith

Parameters

reader

The reader responsible for fetching tokens. The reader must support marking.

roots

The Avail module roots.

Constructors

Link copied to clipboard
fun RenamesFileParser(reader: Reader, roots: ModuleRoots)

Construct a new RenamesFileParser.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun parse(): ModuleNameResolver

Parse the source text and answer a module with the appropriate renaming rules.