Skip to content

Commit

Permalink
front/nimconf: add exported version of readConfigFile (#1007)
Browse files Browse the repository at this point in the history
## Summary
This API is used by [nimph](https://github.com/disruptek/nimph) to read
configuration files for modification.

## Details
* This is a part of the effort to get nimph running with nimskull

---------

Co-authored-by: Saem Ghani <[email protected]>
  • Loading branch information
alaviss and saem authored Nov 4, 2023
1 parent a44b614 commit 72fe3fc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions compiler/front/nimconf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ type
CancelConfigProcessing = object of CatchableError
## internal error used to halt processing


# ---------------- configuration file parser -----------------------------
# we use Nim's lexer here to save space and work

Expand Down Expand Up @@ -502,4 +501,11 @@ proc loadConfigs*(
stopOnError: stopOnError)
parser.loadConfigs(cfg, cache)


proc readConfigFile*(
filename: AbsoluteFile, cache: IdentCache,
conf: ConfigRef, evtHandler: NimConfEvtWriter
): bool {.inline.} =
# created and exported for `nimph`
var parser = NimConfParser(config: conf, cfgEvtWriter: evtHandler,
stopOnError: true)
parser.readConfigFile(filename, cache)

0 comments on commit 72fe3fc

Please sign in to comment.