From d9a1850d3a56b50f94d51ff170fc1af34f93695c Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 18:29:34 +0900 Subject: [PATCH 1/8] misc/enumstr.sh: fix a typo Signed-off-by: Masatake YAMATO --- misc/enumstr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/enumstr.sh b/misc/enumstr.sh index 58719a388f..21db26befd 100755 --- a/misc/enumstr.sh +++ b/misc/enumstr.sh @@ -48,7 +48,7 @@ else fi fi -echo 'static const char *'"$FUNAME"'(enum '$ENUM_NAME' e)' +echo 'static const char *'"$FUNNAME"'(enum '$ENUM_NAME' e)' printf '{ /* Generated by misc/enumstr.sh with cmdline:\n' echo " $0 $INPUT_FILE $ENUM_NAME $FUNNAME $PREFIX_FOR_TRIMMING $USE_LOWER_BITS_AS_IS */" echo ' switch (e)' From 762189c76a95e5acdb862015078ceccd9cdce0bd Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 18:36:37 +0900 Subject: [PATCH 2/8] misc/enumstr.sh,refactor: rewrite the way to parsing commande line Signed-off-by: Masatake YAMATO --- misc/enumstr.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/misc/enumstr.sh b/misc/enumstr.sh index 21db26befd..155685b946 100755 --- a/misc/enumstr.sh +++ b/misc/enumstr.sh @@ -33,20 +33,22 @@ ENUM_NAME=$2 FUNNAME=$3 shift 3 -if [ "$1" = "--use-lower-bits-as-is" ]; then - PREFIX_FOR_TRIMMING= - USE_LOWER_BITS_AS_IS=$1 - shift 1 -else - PREFIX_FOR_TRIMMING=$1 - shift 1 - if [ "$1" = "--use-lower-bits-as-is" ]; then - USE_LOWER_BITS_AS_IS=$1 - shift 1 - else - USE_LOWER_BITS_AS_IS= - fi -fi +while [ $# -gt 0 ]; do + case "$1" in + --use-lower-bits-as-is) + USE_LOWER_BITS_AS_IS=$1 + shift 1 + ;; + -*) + echo "Unknown option: $1" 1>&2 + exit 1 + ;; + *) + PREFIX_FOR_TRIMMING=$1 + shift 1 + ;; + esac +done echo 'static const char *'"$FUNNAME"'(enum '$ENUM_NAME' e)' printf '{ /* Generated by misc/enumstr.sh with cmdline:\n' From fdef4606a46af9b57d65a2303e8bd946c9428182 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 18:43:31 +0900 Subject: [PATCH 3/8] misc/enumstr.sh: add --help option Signed-off-by: Masatake YAMATO --- misc/enumstr.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/misc/enumstr.sh b/misc/enumstr.sh index 155685b946..ebac096bc0 100755 --- a/misc/enumstr.sh +++ b/misc/enumstr.sh @@ -33,8 +33,34 @@ ENUM_NAME=$2 FUNNAME=$3 shift 3 +print_usage() +{ + echo Usage: + echo + echo " $0 [PREFIX_FOR_TRIMMING] [OPTIONS]" + echo " $0 --help|-h" + echo + echo Options: + echo + echo " --use-lower-bits-as-is" + echo + echo Example: + echo + echo ' $ bash ./misc/enumstr.sh parsers/jscript.c eTokenType tokenTypeName' + exit $1 +} + +if [ -z "$INPUT_FILE" ] || [ -z "$ENUM_NAME" ] || [ -z "$FUNNAME" ] || \ + [ "$INPUT_FILE" = '-h' ] || [ "$ENUM_NAME" = '-h' ] || [ "$FUNNAME" = '-h' ] || \ + [ "$INPUT_FILE" = '--help' ] || [ "$ENUM_NAME" = '--help' ] || [ "$FUNNAME" = '--help' ]; then + print_usage 1 1>&2 +fi + while [ $# -gt 0 ]; do case "$1" in + --help|-h) + print_usage 0 + ;; --use-lower-bits-as-is) USE_LOWER_BITS_AS_IS=$1 shift 1 From 447d7c6234fe239a0f3cb825df0909bbadbfb3ea Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 18:46:46 +0900 Subject: [PATCH 4/8] misc/enumstr.sh: add --extern option Signed-off-by: Masatake YAMATO --- misc/enumstr.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/enumstr.sh b/misc/enumstr.sh index ebac096bc0..4f5f5458b2 100755 --- a/misc/enumstr.sh +++ b/misc/enumstr.sh @@ -43,6 +43,7 @@ print_usage() echo Options: echo echo " --use-lower-bits-as-is" + echo " --extern" echo echo Example: echo @@ -56,6 +57,9 @@ if [ -z "$INPUT_FILE" ] || [ -z "$ENUM_NAME" ] || [ -z "$FUNNAME" ] || \ print_usage 1 1>&2 fi +USE_LOWER_BITS_AS_IS= +SCOPE='static' + while [ $# -gt 0 ]; do case "$1" in --help|-h) @@ -65,6 +69,10 @@ while [ $# -gt 0 ]; do USE_LOWER_BITS_AS_IS=$1 shift 1 ;; + --extern) + SCOPE=extern + shift 1 + ;; -*) echo "Unknown option: $1" 1>&2 exit 1 @@ -76,7 +84,7 @@ while [ $# -gt 0 ]; do esac done -echo 'static const char *'"$FUNNAME"'(enum '$ENUM_NAME' e)' +printf '%s const char *'"%s"'(enum '%s' e)\n' "$SCOPE" "$FUNNAME" "$ENUM_NAME" printf '{ /* Generated by misc/enumstr.sh with cmdline:\n' echo " $0 $INPUT_FILE $ENUM_NAME $FUNNAME $PREFIX_FOR_TRIMMING $USE_LOWER_BITS_AS_IS */" echo ' switch (e)' From 9223cc381d21635ee2798eab4ad8e930423981c4 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 5 Jan 2023 09:41:51 +0900 Subject: [PATCH 5/8] misc/review: print the fullname of expected.tags when it is not found Signed-off-by: Masatake YAMATO --- misc/review | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/review b/misc/review index 01e89947bd..d34f937128 100755 --- a/misc/review +++ b/misc/review @@ -154,7 +154,7 @@ units_inspect_cmd_show_generic () if [[ -r "$f" ]]; then "$@" "$f" else - echo "No ${file}" 1>&2 + echo "No $f" 1>&2 fi echo '---' echo '# ' "$f" From 1775cfb460dbe952442dc65d369ae5ea0ba4d8a8 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 5 Jan 2023 09:42:11 +0900 Subject: [PATCH 6/8] misc/review: fix the extended pattern to glob expected.tags Signed-off-by: Masatake YAMATO --- misc/review | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/review b/misc/review index d34f937128..645832dc32 100755 --- a/misc/review +++ b/misc/review @@ -197,7 +197,7 @@ units_inspect_show_expected_tags () ( shopt -s extglob - units_inspect_cmd_show_generic $tcase $(basename ./Units/${tcase}/expected.tags?\(-*\)) "cat" "-n" + units_inspect_cmd_show_generic $tcase $(basename ./Units/${tcase}/expected.tags?(-*)) "cat" "-n" ) } shopt -u extglob From aa0c0e5b51e52b403b41b2379894049128b31519 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 18:57:18 +0900 Subject: [PATCH 7/8] main: report dependency linking when --verbose is given --- main/dependency.c | 13 +++++++++++++ main/dependency_p.h | 1 + main/parse.c | 3 +++ 3 files changed, 17 insertions(+) diff --git a/main/dependency.c b/main/dependency.c index 512a325ba6..ecb5a9e60c 100644 --- a/main/dependency.c +++ b/main/dependency.c @@ -375,3 +375,16 @@ extern void subparserColprintTablePrint (struct colprintTable *table, colprintTableSort (table, subparserColprintCompareLines); colprintTablePrint (table, 0, withListHeader, machinable, fp); } + +extern const char *dependencyTypeString(enum eDepType e) +{ /* Generated by misc/enumstr.sh with cmdline: + misc/enumstr.sh main/dependency.h eDepType dependencyTypeString DEPTYPE_ */ + switch (e) + { + case DEPTYPE_KIND_OWNER: return "KIND_OWNER"; + case DEPTYPE_SUBPARSER: return "SUBPARSER"; + case DEPTYPE_FOREIGNER: return "FOREIGNER"; + case COUNT_DEPTYPES: return "COUNT_DEPTYPES"; + default: return "UNKNOWN"; + } +} diff --git a/main/dependency_p.h b/main/dependency_p.h index d59e9b3d61..d1b7f62017 100644 --- a/main/dependency_p.h +++ b/main/dependency_p.h @@ -55,4 +55,5 @@ extern void finalizeDependencies (parserDefinition *parser, extern slaveParser *getFirstSlaveParser(struct slaveControlBlock *controlBlock); extern slaveParser *getNextSlaveParser(slaveParser *last); +extern const char *dependencyTypeString(enum eDepType e); #endif /* CTAGS_MAIN_DEPENDENCY_PRIVATE_H */ diff --git a/main/parse.c b/main/parse.c index 72e9290f6a..75e3640947 100644 --- a/main/parse.c +++ b/main/parse.c @@ -1954,6 +1954,9 @@ static void linkDependenciesAtInitializeParsing (parserDefinition *const parser) upperParser = LanguageTable + upper; + verbose ("link dependencies: type = %s, upper = %s, lower = %s\n", + dependencyTypeString(d->type), + upperParser->def->name, lowerParser->name); linkDependencyAtInitializeParsing (d->type, upperParser->def, upperParser->slaveControlBlock, upperParser->kindControlBlock, From 4e112023b426ee104c94ede86f109a833c1ed6c9 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 4 Jan 2023 22:12:13 +0900 Subject: [PATCH 8/8] docs(web): fix typos in description of new parsers Signed-off-by: Masatake YAMATO --- docs/news.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 7b70de2e32..a7b1f26b09 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -414,7 +414,7 @@ The following parsers have been added: * Elm *peg/packcc* * Falcon * FrontMatter *only YAML syntax, running as a guest on R?Markdown* -* FunctionParameters *perl based subparser* +* FunctionParameters *Perl based subparser* * Gdbinit script *optlib* * GemSpec *Ruby based subparser* * GDScript @@ -423,7 +423,7 @@ The following parsers have been added: * GPerf *optlib* * Haskell * Haxe -* iPythonCell *optlib*, *pthon based subparser* +* iPythonCell *optlib*, *Python based subparser* * Inko *optlib* * JavaProperties * JSON @@ -437,7 +437,7 @@ The following parsers have been added: * Maven2 *libxml* * MesonBuild (Meson) *optlib* * MesonOptions *optlib+script* -* Moose *perl based subparser* +* Moose *Perl based subparser* * Myrddin * M4 * NSIS