Add -f:ast1, lesser debug output

This commit is contained in:
Ganesh Viswanathan 2020-04-29 14:38:35 -05:00
commit 2278f0e49d
9 changed files with 9 additions and 16 deletions

View file

@ -106,7 +106,7 @@ type
nodeBranch*: seq[string] nodeBranch*: seq[string]
Feature* = enum Feature* = enum
ast2 ast1, ast2
var var
gStateCT {.compiletime, used.} = new(State) gStateCT {.compiletime, used.} = new(State)
@ -123,7 +123,7 @@ when not declared(CIMPORT):
# Redirect output to file when required # Redirect output to file when required
template gecho*(args: string) = template gecho*(args: string) =
if gState.outputHandle.isNil: if gState.outputHandle.isNil:
echo args stdout.writeLine(args)
else: else:
gState.outputHandle.writeLine(args) gState.outputHandle.writeLine(args)

View file

@ -21,7 +21,7 @@ proc process(gState: State, path: string, astTable: AstTable) =
elif gState.pnim: elif gState.pnim:
if Feature.ast2 in gState.feature: if Feature.ast2 in gState.feature:
ast2.parseNim(gState, path, root) ast2.parseNim(gState, path, root)
else: elif Feature.ast1 in gState.feature:
ast.parseNim(gState, path, root, astTable) ast.parseNim(gState, path, root, astTable)
elif gState.preprocess: elif gState.preprocess:
gecho gState.code gecho gState.code
@ -33,7 +33,7 @@ proc main(
debug = false, debug = false,
defines: seq[string] = @[], defines: seq[string] = @[],
dynlib: string = "", dynlib: string = "",
feature: seq[Feature] = @[], feature: seq[Feature] = @[Feature.ast1],
includeHeader = false, includeHeader = false,
includeDirs: seq[string] = @[], includeDirs: seq[string] = @[],
mode = "", mode = "",
@ -118,13 +118,13 @@ proc main(
# Process grammar into AST # Process grammar into AST
let let
astTable = astTable =
if Feature.ast2 notin gState.feature: if Feature.ast1 in gState.feature:
parseGrammar() parseGrammar()
else: else:
nil nil
if pgrammar: if pgrammar:
if Feature.ast2 notin gState.feature: if Feature.ast1 in gState.feature:
# Print AST of grammar # Print AST of grammar
gState.printGrammar(astTable) gState.printGrammar(astTable)
elif source.nBl: elif source.nBl:
@ -137,8 +137,10 @@ proc main(
if gState.pnim: if gState.pnim:
if Feature.ast2 in gState.feature: if Feature.ast2 in gState.feature:
ast2.printNim(gState) ast2.printNim(gState)
else: elif Feature.ast1 in gState.feature:
ast.printNim(gState) ast.printNim(gState)
gecho """{.hint: "The legacy wrapper generation algorithm is deprecated and will be removed in the next release of Nimterop.".}"""
gecho """{.hint: "Refer to CHANGES.md for details on migrating to the new backend.".}"""
# Close outputFile # Close outputFile
if outputFile.len != 0: if outputFile.len != 0:

View file

@ -7,7 +7,6 @@ const
flags = "--prefix=___,__,_ --suffix=__,_" flags = "--prefix=___,__,_ --suffix=__,_"
static: static:
cDebug()
cSkipSymbol(@[ cSkipSymbol(@[
"PRIX8", "PRIX16", "PRIX32", "PRIX8", "PRIX16", "PRIX32",
"PRIXLEAST8", "PRIXLEAST16", "PRIXLEAST32", "PRIXLEAST8", "PRIXLEAST16", "PRIXLEAST32",

View file

@ -7,7 +7,6 @@ static:
# the VM does not support it # the VM does not support it
when (NimMajor, NimMinor, NimPatch) < (1, 0, 0): when (NimMajor, NimMinor, NimPatch) < (1, 0, 0):
cSkipSymbol @["CASTEXPR"] cSkipSymbol @["CASTEXPR"]
cDebug()
const const
path = currentSourcePath.parentDir() / "include" / "tast2.h" path = currentSourcePath.parentDir() / "include" / "tast2.h"

View file

@ -19,7 +19,6 @@ static:
cSkipSymbol @["math_errhandling", "FP_ILOGB0", "FP_ILOGBNAN"] cSkipSymbol @["math_errhandling", "FP_ILOGB0", "FP_ILOGBNAN"]
else: else:
cSkipSymbol @["math_errhandling"] cSkipSymbol @["math_errhandling"]
cDebug()
cDisableCaching() cDisableCaching()
cAddStdDir() cAddStdDir()

View file

@ -3,7 +3,6 @@ import nimterop/cimport
import nimterop/paths import nimterop/paths
static: static:
cDebug()
cDisableCaching() cDisableCaching()
cAddSearchDir testsIncludeDir() cAddSearchDir testsIncludeDir()

View file

@ -3,7 +3,6 @@ import nimterop/cimport
import nimterop/paths import nimterop/paths
static: static:
cDebug()
cDisableCaching() cDisableCaching()
cAddSearchDir testsIncludeDir() cAddSearchDir testsIncludeDir()

View file

@ -9,7 +9,6 @@ const
static: static:
if not pcreH.fileExists(): if not pcreH.fileExists():
downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir) downloadUrl("https://github.com/svn2github/pcre/raw/master/pcre.h.in", baseDir)
cDebug()
cDisableCaching() cDisableCaching()
const const

View file

@ -5,9 +5,6 @@ import nimterop/[build, cimport]
const const
baseDir = getProjectCacheDir("nimterop" / "tests" / "zlib") baseDir = getProjectCacheDir("nimterop" / "tests" / "zlib")
static:
cDebug()
proc zlibPreBuild(outdir, path: string) = proc zlibPreBuild(outdir, path: string) =
let let
mf = outdir / "Makefile" mf = outdir / "Makefile"