Adjust git checkout if changed, tree-sitter version bump
This commit is contained in:
parent
a0413f1595
commit
85a4365e3c
5 changed files with 25 additions and 10 deletions
|
|
@ -323,6 +323,12 @@ proc gitCheckout*(file, outdir: string) =
|
||||||
sleep(500)
|
sleep(500)
|
||||||
gecho "# Retrying ..."
|
gecho "# Retrying ..."
|
||||||
|
|
||||||
|
proc gitAtCheckout*(outdir, checkout: string): bool =
|
||||||
|
## Check if specified git repository is checked out to the specified
|
||||||
|
## commit hash, tag or branch
|
||||||
|
result = checkout in execAction(
|
||||||
|
&"cd {outdir.sanitizePath} && git log --decorate --no-color -n 1 --format=oneline").output
|
||||||
|
|
||||||
proc gitPull*(url: string, outdir = "", plist = "", checkout = "", quiet = false) =
|
proc gitPull*(url: string, outdir = "", plist = "", checkout = "", quiet = false) =
|
||||||
## Pull the specified git repository to the output directory
|
## Pull the specified git repository to the output directory
|
||||||
##
|
##
|
||||||
|
|
@ -334,13 +340,17 @@ proc gitPull*(url: string, outdir = "", plist = "", checkout = "", quiet = false
|
||||||
## `checkout` is the git tag, branch or commit hash to checkout once
|
## `checkout` is the git tag, branch or commit hash to checkout once
|
||||||
## the repository is downloaded. This allows for pinning to a specific
|
## the repository is downloaded. This allows for pinning to a specific
|
||||||
## version of the code.
|
## version of the code.
|
||||||
if dirExists(outdir/".git"):
|
|
||||||
gitReset(outdir)
|
|
||||||
return
|
|
||||||
|
|
||||||
let
|
let
|
||||||
outdirQ = outdir.sanitizePath
|
outdirQ = outdir.sanitizePath
|
||||||
|
|
||||||
|
if dirExists(outdir/".git"):
|
||||||
|
gitReset(outdir)
|
||||||
|
if checkout.nBl and not gitAtCheckout(outdir, checkout):
|
||||||
|
gecho &"# Updating repository to checkout {checkout}"
|
||||||
|
discard execAction(
|
||||||
|
&"cd {outdirQ} && git clean -fxd && git fetch && git checkout {checkout}", retry = 3)
|
||||||
|
return
|
||||||
|
|
||||||
mkDir(outdir)
|
mkDir(outdir)
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,9 @@ when defined(TOAST):
|
||||||
"bitwise_expression",
|
"bitwise_expression",
|
||||||
"shift_expression",
|
"shift_expression",
|
||||||
"math_expression",
|
"math_expression",
|
||||||
"escape_sequence"
|
"escape_sequence",
|
||||||
|
"binary_expression",
|
||||||
|
"unary_expression"
|
||||||
].toHashSet()
|
].toHashSet()
|
||||||
|
|
||||||
gEnumVals* {.used.} = @[
|
gEnumVals* {.used.} = @[
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ proc treesitterSetup*() =
|
||||||
gitPull("https://github.com/tree-sitter/tree-sitter", cacheDir / "treesitter", """
|
gitPull("https://github.com/tree-sitter/tree-sitter", cacheDir / "treesitter", """
|
||||||
lib/include/*
|
lib/include/*
|
||||||
lib/src/*
|
lib/src/*
|
||||||
""", "0.15.5")
|
""", "0.15.14")
|
||||||
|
|
||||||
gitPull("https://github.com/JuliaStrings/utf8proc", cacheDir / "utf8proc", """
|
gitPull("https://github.com/JuliaStrings/utf8proc", cacheDir / "utf8proc", """
|
||||||
*.c
|
*.c
|
||||||
|
|
@ -37,7 +37,7 @@ src/*.h
|
||||||
src/*.c
|
src/*.c
|
||||||
src/*.cc
|
src/*.cc
|
||||||
src/tree_sitter/parser.h
|
src/tree_sitter/parser.h
|
||||||
""", "v0.15.0")
|
""", "v0.15.3")
|
||||||
|
|
||||||
writeFile(cacheDir / "treesitter_c" / "src" / "api.h", """
|
writeFile(cacheDir / "treesitter_c" / "src" / "api.h", """
|
||||||
const TSLanguage *tree_sitter_c();
|
const TSLanguage *tree_sitter_c();
|
||||||
|
|
@ -49,7 +49,7 @@ src/*.h
|
||||||
src/*.c
|
src/*.c
|
||||||
src/*.cc
|
src/*.cc
|
||||||
src/tree_sitter/parser.h
|
src/tree_sitter/parser.h
|
||||||
""", "v0.15.0")
|
""", "v0.15.1")
|
||||||
|
|
||||||
writeFile(cacheDir / "treesitter_cpp" / "src" / "api.h", """
|
writeFile(cacheDir / "treesitter_cpp" / "src" / "api.h", """
|
||||||
const TSLanguage *tree_sitter_cpp();
|
const TSLanguage *tree_sitter_cpp();
|
||||||
|
|
|
||||||
|
|
@ -1099,6 +1099,9 @@ proc getTypeProc(gState: State, name: string, node, rnode: TSNode): PNode =
|
||||||
ncount =
|
ncount =
|
||||||
if not afdecl.isNil:
|
if not afdecl.isNil:
|
||||||
# Pointer to function pointer
|
# Pointer to function pointer
|
||||||
|
if afdecl[0].getName() == "abstract_parenthesized_declarator":
|
||||||
|
afdecl[0][0].getXCount("abstract_pointer_declarator")
|
||||||
|
else:
|
||||||
afdecl[0].getXCount("abstract_pointer_declarator")
|
afdecl[0].getXCount("abstract_pointer_declarator")
|
||||||
else:
|
else:
|
||||||
node.getAtom().tsNodeParent().getPtrCount(reverse = true)
|
node.getAtom().tsNodeParent().getPtrCount(reverse = true)
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,7 @@ proc processTSNode(gState: State, node: TSNode, typeofNode: var PNode): PNode =
|
||||||
# once we upgrade
|
# once we upgrade
|
||||||
of "math_expression", "logical_expression", "relational_expression",
|
of "math_expression", "logical_expression", "relational_expression",
|
||||||
"bitwise_expression", "equality_expression", "binary_expression",
|
"bitwise_expression", "equality_expression", "binary_expression",
|
||||||
"shift_expression":
|
"shift_expression", "unary_expression":
|
||||||
# Input -> a == b, a != b, !a, ~a, a < b, a > b, a <= b, a >= b, a >> b, a << b
|
# Input -> a == b, a != b, !a, ~a, a < b, a > b, a <= b, a >= b, a >> b, a << b
|
||||||
# Output ->
|
# Output ->
|
||||||
# typeof(a)(a == typeof(a)(b))
|
# typeof(a)(a == typeof(a)(b))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue