This commit is contained in:
parent
532647171e
commit
d1fe195dcc
4 changed files with 33 additions and 16 deletions
|
|
@ -158,14 +158,18 @@ proc openParsers*(p: var TParsers, fileIdx: FileIndex, inputstream: PLLStream;
|
|||
proc closeParsers*(p: var TParsers) =
|
||||
parser.closeParser(p.parser)
|
||||
|
||||
proc parseFile*(fileIdx: FileIndex; cache: IdentCache; config: ConfigRef): PNode {.procvar.} =
|
||||
var
|
||||
p: TParsers
|
||||
f: File
|
||||
proc setupParsers*(p: var TParsers; fileIdx: FileIndex; cache: IdentCache;
|
||||
config: ConfigRef): bool =
|
||||
var f: File
|
||||
let filename = toFullPathConsiderDirty(config, fileIdx)
|
||||
if not open(f, filename.string):
|
||||
rawMessage(config, errGenerated, "cannot open file: " & filename.string)
|
||||
return
|
||||
return false
|
||||
openParsers(p, fileIdx, llStreamOpen(f), cache, config)
|
||||
result = parseAll(p)
|
||||
closeParsers(p)
|
||||
result = true
|
||||
|
||||
proc parseFile*(fileIdx: FileIndex; cache: IdentCache; config: ConfigRef): PNode {.procvar.} =
|
||||
var p: TParsers
|
||||
if setupParsers(p, fileIdx, cache, config):
|
||||
result = parseAll(p)
|
||||
closeParsers(p)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue