Skip to content

Commit

Permalink
Merge pull request #54 from ehmry/no-os
Browse files Browse the repository at this point in the history
Avoid the OS if possible
  • Loading branch information
zevv committed Dec 30, 2022
2 parents 42bdcc9 + 0114d8d commit 8ed85bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/npeg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import tables
import macros
import strutils
import npeg/[common,codegen,capture,parsepatt,grammar,dot]
import os

export NPegException, contains, `[]`, len

Expand Down Expand Up @@ -146,7 +145,7 @@ proc match*[S](p: Parser, s: openArray[S]): MatchResult[S] =
# Match a file

when defined(windows) or defined(posix):
import memfiles
import memfiles, os
proc matchFile*[T](p: Parser, fname: string, userData: var T): MatchResult[char] =
# memfiles.open() throws on empty files, work around that
if os.getFileSize(fname) > 0:
Expand Down
2 changes: 1 addition & 1 deletion src/npeg/dot.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ proc addPatt*(d: Dot, name: string, len: int) =

proc dump*(d: Dot) =
const npegDotDir {.strdefine.}: string = ""
if npegDotDir != "":
when npegDotDir != "":
let fname = npegDotDir & "/" & d.name & ".dot"
echo "Dumping dot graph file to " & fname & "..."

Expand Down

0 comments on commit 8ed85bb

Please sign in to comment.