ci: use clang-format from LLVM 16 (#3696)
Co-authored-by: wargio <wargio@libero.it>
This commit is contained in:
parent
8b3a444dbd
commit
3278ec77d0
9 changed files with 71 additions and 65 deletions
15
.github/workflows/linter.yml
vendored
15
.github/workflows/linter.yml
vendored
|
|
@ -112,18 +112,21 @@ jobs:
|
|||
- name: Install wget, software-properties-common, lsb-release (dependencies of LLVM install script)
|
||||
run: sudo apt --assume-yes install wget software-properties-common lsb-release
|
||||
|
||||
- name: Install automatic LLVM 15
|
||||
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 15
|
||||
- name: Uninstall old conflicting packages
|
||||
run: sudo apt purge --assume-yes --auto-remove llvm python3-lldb-14 llvm-14
|
||||
|
||||
- name: Install clang-format-15
|
||||
run: sudo apt --assume-yes install clang-format-15
|
||||
- name: Install automatic LLVM 16
|
||||
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 16
|
||||
|
||||
- name: Install clang-format-16
|
||||
run: sudo apt --assume-yes install clang-format-16
|
||||
|
||||
- name: Install gitpython
|
||||
run: sudo pip install gitpython
|
||||
|
||||
- name: Run clang-format
|
||||
run: |
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 150
|
||||
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 160
|
||||
clang-format --version
|
||||
python sys/clang-format.py --check --verbose
|
||||
|
||||
|
|
@ -141,7 +144,7 @@ jobs:
|
|||
npm install prettier
|
||||
|
||||
- name: Run prettier
|
||||
run: find . -name "*.js" | grep -v "subprojects/tree-sitter-0" | grep -v "bindings/node/index.js" | xargs npx prettier --print-width 120 --check
|
||||
run: find . -name "*.js" | grep -v "bindings/node/index.js\|subprojects/tree-sitter" | xargs npx prettier --print-width 120 --check
|
||||
|
||||
python:
|
||||
needs: changes
|
||||
|
|
|
|||
|
|
@ -1708,7 +1708,7 @@ static RzILOpEffect *qadd16(cs_insn *insn, bool is_thumb) {
|
|||
}
|
||||
bool is_signed = insn->id == ARM_INS_QADD16 || insn->id == ARM_INS_QSUB16 || insn->id == ARM_INS_QASX ||
|
||||
insn->id == ARM_INS_QSAX;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector * val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector *val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
RzILOpBitVector *al = cast(17, UNSIGNED(16, a));
|
||||
RzILOpBitVector *ah = cast(17, UNSIGNED(16, SHIFTR0(DUP(a), UN(5, 16))));
|
||||
RzILOpBitVector *bl = cast(17, UNSIGNED(16, b));
|
||||
|
|
@ -1769,7 +1769,7 @@ static RzILOpEffect *qadd8(cs_insn *insn, bool is_thumb) {
|
|||
}
|
||||
bool is_signed = insn->id == ARM_INS_QADD8 || insn->id == ARM_INS_QSUB8;
|
||||
bool is_sub = insn->id == ARM_INS_QSUB8 || insn->id == ARM_INS_UQSUB8;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector * val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector *val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
return SEQ5(
|
||||
saturate(is_signed, is_sub, "rb0", 8,
|
||||
is_sub
|
||||
|
|
@ -1925,7 +1925,7 @@ static RzILOpEffect *sadd16(cs_insn *insn, bool is_thumb) {
|
|||
bool is_signed = insn->id == ARM_INS_SADD16 || insn->id == ARM_INS_SHADD16 || insn->id == ARM_INS_SASX ||
|
||||
insn->id == ARM_INS_SSAX || insn->id == ARM_INS_SHASX || insn->id == ARM_INS_SHSAX ||
|
||||
insn->id == ARM_INS_SSUB16 || insn->id == ARM_INS_SHSUB16;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector * val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector *val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
al = cast(17, al);
|
||||
ah = cast(17, ah);
|
||||
bl = cast(17, bl);
|
||||
|
|
@ -2052,7 +2052,7 @@ static RzILOpEffect *sadd8(cs_insn *insn, bool is_thumb) {
|
|||
if (set_ge) {
|
||||
// Retroactively patch the ops to extend to 8 before the calculation because this is needed for ge
|
||||
// Note: add/sub members here use the same structure, so using just `.add` is fine.
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector * val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
RzILOpBitVector *(*cast)(ut32 length, RzILOpBitVector *val) = is_signed ? rz_il_op_new_signed : rz_il_op_new_unsigned;
|
||||
r0->op.add.x = cast(9, r0->op.add.x);
|
||||
r0->op.add.y = cast(9, r0->op.add.y);
|
||||
r1->op.add.x = cast(9, r1->op.add.x);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static OPCODE_DESC *avr_op_analyze(RzAnalysis *analysis, RzAnalysisOp *op, ut64
|
|||
#define INST_HANDLER(OPCODE_NAME) static void _inst__##OPCODE_NAME(RzAnalysis *analysis, RzAnalysisOp *op, const ut8 *buf, int len, int *fail, CPU_MODEL *cpu)
|
||||
#define INST_DECL(OP, M, SL, C, SZ, T) \
|
||||
{ \
|
||||
#OP, (M), (SL), _inst__##OP, (C), (SZ), RZ_ANALYSIS_OP_TYPE_##T \
|
||||
#OP, (M), (SL), _inst__##OP, (C), (SZ), RZ_ANALYSIS_OP_TYPE_##T \
|
||||
}
|
||||
#define INST_LAST \
|
||||
{ "unknown", 0, 0, (void *)0, 2, 1, RZ_ANALYSIS_OP_TYPE_UNK }
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,7 @@ static char *mips_get_reg_profile(RzAnalysis *analysis) {
|
|||
/* extra */
|
||||
"gpr pc .64 272 0\n";
|
||||
#endif
|
||||
return strdup(p);
|
||||
return strdup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -7,19 +7,18 @@
|
|||
#include <rz_analysis.h>
|
||||
#include <rz_cons.h>
|
||||
|
||||
#if 0
|
||||
/*
|
||||
DICT
|
||||
====
|
||||
|
||||
refs 10->20 C 16->10 J 20->10 C
|
||||
|
||||
xrefs 20->[10 C] 10 -> [16 J, 20 C]
|
||||
xrefs 20->[10 C] 10 -> [16 J, 20 C]
|
||||
|
||||
10 : call 20 16 : jmp 10 20 : call 10
|
||||
#endif
|
||||
|
||||
// XXX: is it possible to have multiple type for the same (from, to) pair?
|
||||
// if it is, things need to be adjusted
|
||||
10 : call 20 16 : jmp 10 20 : call 10
|
||||
*/
|
||||
// TODO: is it possible to have multiple type for the same (from, to) pair?
|
||||
// if it is, things need to be adjusted
|
||||
|
||||
static RzAnalysisXRef *rz_analysis_xref_new(ut64 from, ut64 to, ut64 type) {
|
||||
RzAnalysisXRef *xref = RZ_NEW(RzAnalysisXRef);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ RZ_API bool rz_core_hack_x86(RzCore *core, const char *op, const RzAnalysisOp *a
|
|||
RZ_API bool rz_core_hack(RzCore *core, const char *op) {
|
||||
// TODO: op should not be an unstructered string
|
||||
// TODO: asm/analysis plugins should provide the operations, instead of doing this here
|
||||
bool (*hack)(RzCore * core, const char *op, const RzAnalysisOp *aop) = NULL;
|
||||
bool (*hack)(RzCore *core, const char *op, const RzAnalysisOp *aop) = NULL;
|
||||
const char *asmarch = rz_config_get(core->config, "asm.arch");
|
||||
const int asmbits = core->rasm->bits;
|
||||
|
||||
|
|
|
|||
|
|
@ -1213,7 +1213,7 @@ repeat:
|
|||
#if DEBUGGER
|
||||
/// if the plugin is not compiled link fails, so better do runtime linking
|
||||
/// until this code gets fixed
|
||||
static bool (*linux_attach_new_process)(RzDebug * dbg, int pid) = NULL;
|
||||
static bool (*linux_attach_new_process)(RzDebug *dbg, int pid) = NULL;
|
||||
if (!linux_attach_new_process) {
|
||||
linux_attach_new_process = rz_sys_dlsym(NULL, "linux_attach_new_process");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const ARG_IDENTIFIER_BASE = choice(
|
|||
"$$",
|
||||
/\$[^\s@|#"'>;`~\\({) ]/,
|
||||
/\${[^\r\n $}]+}/,
|
||||
/\\./
|
||||
/\\./,
|
||||
);
|
||||
const SPEC_ARG_IDENTIFIER_BASE = choice(
|
||||
repeat1(noneOf(...SPEC_SPECIAL_CHARACTERS)),
|
||||
|
|
@ -24,7 +24,7 @@ const SPEC_ARG_IDENTIFIER_BASE = choice(
|
|||
"$$",
|
||||
/\$[^\s@|#"'>;`~\\({) ]/,
|
||||
/\${[^\r\n $}]+}/,
|
||||
/\\./
|
||||
/\\./,
|
||||
);
|
||||
const PF_DOT_ARG_IDENTIFIER_BASE = choice(
|
||||
repeat1(noneOf(...PF_DOT_SPECIAL_CHARACTERS)),
|
||||
|
|
@ -32,7 +32,7 @@ const PF_DOT_ARG_IDENTIFIER_BASE = choice(
|
|||
"$$",
|
||||
/\$[^\s@|#"'>;`~\\({) ]/,
|
||||
/\${[^\r\n $}]+}/,
|
||||
/\\./
|
||||
/\\./,
|
||||
);
|
||||
const PF_ARG_IDENTIFIER_BASE = choice(
|
||||
repeat1(noneOf(...PF_SPECIAL_CHARACTERS)),
|
||||
|
|
@ -40,7 +40,7 @@ const PF_ARG_IDENTIFIER_BASE = choice(
|
|||
"$$",
|
||||
/\$[^\s@|#"'>;`~\\({) ]/,
|
||||
/\${[^\r\n $}]+}/,
|
||||
/\\./
|
||||
/\\./,
|
||||
);
|
||||
|
||||
module.exports = grammar({
|
||||
|
|
@ -65,7 +65,7 @@ module.exports = grammar({
|
|||
choice(
|
||||
seq(),
|
||||
seq(repeat($.stmt_delimiter)),
|
||||
seq(repeat($.stmt_delimiter), $._statement, repeat(seq($.stmt_delimiter, optional($._statement))))
|
||||
seq(repeat($.stmt_delimiter), $._statement, repeat(seq($.stmt_delimiter, optional($._statement)))),
|
||||
),
|
||||
_statements_singleline: ($) =>
|
||||
prec(
|
||||
|
|
@ -73,8 +73,8 @@ module.exports = grammar({
|
|||
seq(
|
||||
repeat($.stmt_delimiter_singleline),
|
||||
$._statement,
|
||||
repeat(seq($.stmt_delimiter_singleline, optional($._statement)))
|
||||
)
|
||||
repeat(seq($.stmt_delimiter_singleline, optional($._statement))),
|
||||
),
|
||||
),
|
||||
|
||||
_statement: ($) => choice($.redirect_stmt, $._simple_stmt),
|
||||
|
|
@ -92,7 +92,7 @@ module.exports = grammar({
|
|||
$._pipe_stmt,
|
||||
$.grep_stmt,
|
||||
$.legacy_quoted_stmt,
|
||||
$._pf_stmts
|
||||
$._pf_stmts,
|
||||
),
|
||||
|
||||
_tmp_stmt: ($) =>
|
||||
|
|
@ -112,7 +112,7 @@ module.exports = grammar({
|
|||
$.tmp_file_stmt,
|
||||
$.tmp_string_stmt,
|
||||
$.tmp_value_stmt,
|
||||
$.tmp_hex_stmt
|
||||
$.tmp_hex_stmt,
|
||||
),
|
||||
|
||||
_iter_stmt: ($) =>
|
||||
|
|
@ -140,7 +140,7 @@ module.exports = grammar({
|
|||
$.iter_iomap_stmt,
|
||||
$.iter_dbgmap_stmt,
|
||||
$.iter_register_stmt,
|
||||
$.iter_step_stmt
|
||||
$.iter_step_stmt,
|
||||
),
|
||||
|
||||
_pipe_stmt: ($) => choice($.html_disable_stmt, $.html_enable_stmt, $.pipe_stmt),
|
||||
|
|
@ -154,10 +154,10 @@ module.exports = grammar({
|
|||
choice(
|
||||
seq(
|
||||
repeat1(choice($.grep_specifier_identifier, $.cmd_substitution_arg)),
|
||||
optional(alias(/[$]+/, $.grep_specifier_identifier))
|
||||
optional(alias(/[$]+/, $.grep_specifier_identifier)),
|
||||
),
|
||||
alias(/[$]+/, $.grep_specifier_identifier)
|
||||
)
|
||||
alias(/[$]+/, $.grep_specifier_identifier),
|
||||
),
|
||||
),
|
||||
|
||||
html_disable_stmt: ($) => prec.right(1, seq(field("command", $._simple_stmt), "|")),
|
||||
|
|
@ -214,8 +214,8 @@ module.exports = grammar({
|
|||
1,
|
||||
choice(
|
||||
field("command", alias($.question_mark_identifier, $.cmd_identifier)),
|
||||
field("command", alias($._help_stmt, $.cmd_identifier))
|
||||
)
|
||||
field("command", alias($._help_stmt, $.cmd_identifier)),
|
||||
),
|
||||
),
|
||||
macro_body: ($) => seq(";", $._statement, repeat(seq(";", $._statement))),
|
||||
macro_name: ($) => /[A-Za-z0-9_\-\.]+/,
|
||||
|
|
@ -234,13 +234,13 @@ module.exports = grammar({
|
|||
$._env_stmt,
|
||||
$._pf_arged_stmt,
|
||||
$._last_stmt,
|
||||
$._simple_arged_stmt_question
|
||||
$._simple_arged_stmt_question,
|
||||
),
|
||||
|
||||
_macro_arged_stmt: ($) =>
|
||||
choice(
|
||||
field("command", alias(choice("(", "(-*", "(*"), $.cmd_identifier)),
|
||||
seq(field("command", alias("(-", $.cmd_identifier)), field("args", $.args))
|
||||
seq(field("command", alias("(-", $.cmd_identifier)), field("args", $.args)),
|
||||
),
|
||||
_simple_arged_stmt_question: ($) =>
|
||||
prec.left(1, seq(field("command", alias($._help_stmt, $.cmd_identifier)), field("args", $.args))),
|
||||
|
|
@ -249,15 +249,15 @@ module.exports = grammar({
|
|||
_search_stmt: ($) =>
|
||||
prec.left(
|
||||
1,
|
||||
seq(field("command", alias(/\/[A-Za-z0-9+!\/*]*/, $.cmd_identifier)), field("args", optional($.args)))
|
||||
seq(field("command", alias(/\/[A-Za-z0-9+!\/*]*/, $.cmd_identifier)), field("args", optional($.args))),
|
||||
),
|
||||
_pointer_arged_stmt: ($) =>
|
||||
prec.left(
|
||||
1,
|
||||
seq(
|
||||
field("command", alias($.pointer_identifier, $.cmd_identifier)),
|
||||
field("args", alias($.eq_sep_args, $.args))
|
||||
)
|
||||
field("args", alias($.eq_sep_args, $.args)),
|
||||
),
|
||||
),
|
||||
_system_stmt: ($) => prec.left(1, seq(field("command", $.system_identifier), optional(field("args", $.args)))),
|
||||
_interpret_stmt: ($) =>
|
||||
|
|
@ -267,19 +267,19 @@ module.exports = grammar({
|
|||
seq(field("command", alias(".", $.cmd_identifier)), field("args", $._simple_stmt)),
|
||||
seq(
|
||||
field("command", alias(/\.[\.:\-*]+/, $.cmd_identifier)),
|
||||
optional(seq(/[ ]+/, field("args", optional($.args))))
|
||||
optional(seq(/[ ]+/, field("args", optional($.args)))),
|
||||
),
|
||||
seq(field("command", alias(/\.[ ]+/, $.cmd_identifier)), field("args", optional($.args))),
|
||||
seq(field("command", alias(/\.\.?\(/, $.cmd_identifier)), field("args", optional($.args)), ")"),
|
||||
seq(field("command", alias($._interpret_search_identifier, $.cmd_identifier)), field("args", $.args)),
|
||||
prec.right(1, seq(field("args", $._simple_stmt), field("command", "|.")))
|
||||
)
|
||||
prec.right(1, seq(field("args", $._simple_stmt), field("command", "|."))),
|
||||
),
|
||||
),
|
||||
_interpret_search_identifier: ($) => seq("./"),
|
||||
_pf_arged_stmt: ($) =>
|
||||
choice(
|
||||
seq(field("command", alias($.pf_dot_cmd_identifier, $.cmd_identifier))),
|
||||
seq(field("command", alias("pfo", $.cmd_identifier)), field("args", $.args))
|
||||
seq(field("command", alias("pfo", $.cmd_identifier)), field("args", $.args)),
|
||||
),
|
||||
_pf_stmts: ($) =>
|
||||
prec.left(
|
||||
|
|
@ -292,13 +292,13 @@ module.exports = grammar({
|
|||
// pf.name [0|cnt]fmt
|
||||
alias($.pf_new_cmd, $.arged_stmt),
|
||||
// Cf [sz] [fmt]
|
||||
alias($.Cf_cmd, $.arged_stmt)
|
||||
alias($.Cf_cmd, $.arged_stmt),
|
||||
// pf., pfo fdf_name: will be handled as regular arged_stmt
|
||||
)
|
||||
),
|
||||
),
|
||||
Cf_cmd: ($) =>
|
||||
prec.left(
|
||||
seq(field("command", alias("Cf", $.cmd_identifier)), optional(field("args", alias($._Cf_args, $.args))))
|
||||
seq(field("command", alias("Cf", $.cmd_identifier)), optional(field("args", alias($._Cf_args, $.args)))),
|
||||
),
|
||||
_Cf_args: ($) => seq($.arg, $.pf_args),
|
||||
pf_dot_cmd_identifier: ($) => "pf.",
|
||||
|
|
@ -307,7 +307,7 @@ module.exports = grammar({
|
|||
seq(
|
||||
field("command", alias($.pf_dot_cmd_identifier, $.cmd_identifier)),
|
||||
$._concat_pf_dot,
|
||||
field("args", $.pf_new_args)
|
||||
field("args", $.pf_new_args),
|
||||
),
|
||||
pf_dot_cmd: ($) =>
|
||||
prec.left(
|
||||
|
|
@ -315,8 +315,8 @@ module.exports = grammar({
|
|||
seq(
|
||||
field("command", alias(choice($.pf_dot_cmd_identifier, $.pf_dot_full_cmd_identifier), $.cmd_identifier)),
|
||||
$._concat_pf_dot,
|
||||
field("args", $.pf_dot_cmd_args)
|
||||
)
|
||||
field("args", $.pf_dot_cmd_args),
|
||||
),
|
||||
),
|
||||
pf_cmd: ($) => seq(field("command", alias(/pf[*cjqs]?/, $.cmd_identifier)), field("args", $.pf_args)),
|
||||
pf_new_args: ($) => seq(alias($.pf_dot_arg, $.pf_arg), $.pf_args),
|
||||
|
|
@ -337,15 +337,15 @@ module.exports = grammar({
|
|||
1,
|
||||
seq(
|
||||
alias($.pf_dot_arg, $.pf_arg),
|
||||
repeat(seq($._concat_pf_dot, ".", $._concat_pf_dot, alias($.pf_dot_arg, $.pf_arg)))
|
||||
)
|
||||
repeat(seq($._concat_pf_dot, ".", $._concat_pf_dot, alias($.pf_dot_arg, $.pf_arg))),
|
||||
),
|
||||
),
|
||||
_env_stmt: ($) =>
|
||||
prec.left(
|
||||
seq(
|
||||
field("command", alias($._env_stmt_identifier, $.cmd_identifier)),
|
||||
field("args", optional(alias($.eq_sep_args, $.args)))
|
||||
)
|
||||
field("args", optional(alias($.eq_sep_args, $.args))),
|
||||
),
|
||||
),
|
||||
_env_stmt_identifier: ($) => "env",
|
||||
_last_stmt: ($) => seq(field("command", alias($.last_stmt_identifier, $.cmd_identifier))),
|
||||
|
|
@ -364,7 +364,7 @@ module.exports = grammar({
|
|||
redirect_stmt: ($) =>
|
||||
prec.right(
|
||||
2,
|
||||
seq(field("command", $._simple_stmt), field("redirect_operator", $._redirect_operator), field("arg", $.arg))
|
||||
seq(field("command", $._simple_stmt), field("redirect_operator", $._redirect_operator), field("arg", $.arg)),
|
||||
),
|
||||
_redirect_operator: ($) =>
|
||||
choice($.fdn_redirect_operator, $.fdn_append_operator, $.html_redirect_operator, $.html_append_operator),
|
||||
|
|
@ -381,7 +381,7 @@ module.exports = grammar({
|
|||
$.single_quoted_arg,
|
||||
$.cmd_substitution_arg,
|
||||
alias($._arg_with_paren, $.args),
|
||||
alias(",", $.arg_identifier)
|
||||
alias(",", $.arg_identifier),
|
||||
),
|
||||
arg: ($) => choice($._arg, $.concatenation),
|
||||
args: ($) => prec.left(repeat1($.arg)),
|
||||
|
|
@ -394,7 +394,7 @@ module.exports = grammar({
|
|||
alias($._eq_sep_key_identifier, $.arg_identifier),
|
||||
$.double_quoted_arg,
|
||||
$.single_quoted_arg,
|
||||
$.cmd_substitution_arg
|
||||
$.cmd_substitution_arg,
|
||||
),
|
||||
_eq_sep_key_concatenation: ($) =>
|
||||
prec.left(seq($._eq_sep_key_single, repeat1(seq($._eq_sep_concat, $._eq_sep_key_single)))),
|
||||
|
|
@ -406,9 +406,9 @@ module.exports = grammar({
|
|||
repeat1(noneOf(...SPECIAL_CHARACTERS_EQUAL)),
|
||||
/\$[^({]/,
|
||||
/\${[^\r\n $}]+}/,
|
||||
escape(...SPECIAL_CHARACTERS_EQUAL)
|
||||
)
|
||||
)
|
||||
escape(...SPECIAL_CHARACTERS_EQUAL),
|
||||
),
|
||||
),
|
||||
),
|
||||
_eq_sep_val_concatenation: ($) => prec.left(1, seq($.arg, repeat1(seq($._eq_sep_concat, $.arg)))),
|
||||
_eq_sep_val: ($) => choice($._arg, alias($._eq_sep_val_concatenation, $.concatenation)),
|
||||
|
|
@ -421,7 +421,7 @@ module.exports = grammar({
|
|||
seq(
|
||||
'"',
|
||||
repeat(choice(token.immediate(prec(1, /[^\\"\n$`]+/)), /\$[^("]?/, /\\[\\"\n$`]?/, $.cmd_substitution_arg)),
|
||||
'"'
|
||||
'"',
|
||||
),
|
||||
single_quoted_arg: ($) => seq("'", repeat(choice(token.immediate(prec(1, /[^\\'\n]+/)), /\\[\\'\n]?/)), "'"),
|
||||
cmd_substitution_arg: ($) =>
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ def get_edited_files(args):
|
|||
yield filename
|
||||
|
||||
|
||||
def build_command(check, filenames, verbose):
|
||||
cmd = ["clang-format", "--style=file"]
|
||||
def build_command(clangformat, check, filenames, verbose):
|
||||
cmd = [clangformat, "--style=file"]
|
||||
if verbose:
|
||||
cmd += ["--verbose"]
|
||||
if check:
|
||||
|
|
@ -85,7 +85,7 @@ def format_files(args, files):
|
|||
if len(files) == 0:
|
||||
print("No C files to format.")
|
||||
sys.exit(0)
|
||||
cmd = build_command(args.check, files, args.verbose)
|
||||
cmd = build_command(args.clang_format, args.check, files, args.verbose)
|
||||
r = subprocess.run(cmd, check=False)
|
||||
sys.exit(r.returncode)
|
||||
|
||||
|
|
@ -115,6 +115,10 @@ def process(args):
|
|||
|
||||
def parse():
|
||||
parser = argparse.ArgumentParser(description="Clang format the rizin project")
|
||||
|
||||
parser.add_argument(
|
||||
"-C", "--clang-format", default="clang-format", help="path of clang-format"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c", "--check", action="store_true", help="enable the check mode"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue