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)
|
||||
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) =
|
||||
## 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
|
||||
## the repository is downloaded. This allows for pinning to a specific
|
||||
## version of the code.
|
||||
if dirExists(outdir/".git"):
|
||||
gitReset(outdir)
|
||||
return
|
||||
|
||||
let
|
||||
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)
|
||||
|
||||
if not quiet:
|
||||
|
|
|
|||
|
|
@ -111,7 +111,9 @@ when defined(TOAST):
|
|||
"bitwise_expression",
|
||||
"shift_expression",
|
||||
"math_expression",
|
||||
"escape_sequence"
|
||||
"escape_sequence",
|
||||
"binary_expression",
|
||||
"unary_expression"
|
||||
].toHashSet()
|
||||
|
||||
gEnumVals* {.used.} = @[
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ proc treesitterSetup*() =
|
|||
gitPull("https://github.com/tree-sitter/tree-sitter", cacheDir / "treesitter", """
|
||||
lib/include/*
|
||||
lib/src/*
|
||||
""", "0.15.5")
|
||||
""", "0.15.14")
|
||||
|
||||
gitPull("https://github.com/JuliaStrings/utf8proc", cacheDir / "utf8proc", """
|
||||
*.c
|
||||
|
|
@ -37,7 +37,7 @@ src/*.h
|
|||
src/*.c
|
||||
src/*.cc
|
||||
src/tree_sitter/parser.h
|
||||
""", "v0.15.0")
|
||||
""", "v0.15.3")
|
||||
|
||||
writeFile(cacheDir / "treesitter_c" / "src" / "api.h", """
|
||||
const TSLanguage *tree_sitter_c();
|
||||
|
|
@ -49,7 +49,7 @@ src/*.h
|
|||
src/*.c
|
||||
src/*.cc
|
||||
src/tree_sitter/parser.h
|
||||
""", "v0.15.0")
|
||||
""", "v0.15.1")
|
||||
|
||||
writeFile(cacheDir / "treesitter_cpp" / "src" / "api.h", """
|
||||
const TSLanguage *tree_sitter_cpp();
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,10 @@ proc getTypeProc(gState: State, name: string, node, rnode: TSNode): PNode =
|
|||
ncount =
|
||||
if not afdecl.isNil:
|
||||
# Pointer to function pointer
|
||||
afdecl[0].getXCount("abstract_pointer_declarator")
|
||||
if afdecl[0].getName() == "abstract_parenthesized_declarator":
|
||||
afdecl[0][0].getXCount("abstract_pointer_declarator")
|
||||
else:
|
||||
afdecl[0].getXCount("abstract_pointer_declarator")
|
||||
else:
|
||||
node.getAtom().tsNodeParent().getPtrCount(reverse = true)
|
||||
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ proc processTSNode(gState: State, node: TSNode, typeofNode: var PNode): PNode =
|
|||
# once we upgrade
|
||||
of "math_expression", "logical_expression", "relational_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
|
||||
# Output ->
|
||||
# typeof(a)(a == typeof(a)(b))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue