Merge 6ce94533959466f146556424dd293b8d23424900 into 3698462af9480b0cf2ea54ade32f6f7712f50785
This commit is contained in:
commit
09d8db7fe9
@ -58,6 +58,7 @@ parsers = \
|
||||
parsers/css.c \
|
||||
parsers/diff.c \
|
||||
parsers/geany_docbook.c \
|
||||
parsers/dosbatch.c \
|
||||
parsers/erlang.c \
|
||||
parsers/flex.c \
|
||||
parsers/fortran.c \
|
||||
|
||||
44
ctags/parsers/dosbatch.c
Normal file
44
ctags/parsers/dosbatch.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2009, David Fishburn
|
||||
*
|
||||
* This source code is released for free distribution under the terms of the
|
||||
* GNU General Public License version 2 or (at your option) any later version.
|
||||
*
|
||||
* This module contains functions for generating tags for DOS Batch language files.
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
*/
|
||||
#include "general.h" /* must always come first */
|
||||
|
||||
#include <string.h>
|
||||
#include "parse.h"
|
||||
#include "routines.h"
|
||||
#include "selectors.h"
|
||||
|
||||
static tagRegexTable dosTagRegexTable [] = {
|
||||
{"^:([A-Za-z_0-9]+)", "\\1",
|
||||
"l,label,labels", NULL},
|
||||
{"set[ \t]+([A-Za-z_0-9]+)[ \t]*=", "\\1",
|
||||
"v,variable,variables", NULL},
|
||||
};
|
||||
|
||||
/*
|
||||
* FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
extern parserDefinition* DosBatchParser (void)
|
||||
{
|
||||
static const char *const extensions [] = { "bat", "cmd", NULL };
|
||||
parserDefinition* const def = parserNew ("DosBatch");
|
||||
static selectLanguage selectors[] = { selectByRexxCommentAndDosbatchLabelPrefix,
|
||||
NULL };
|
||||
|
||||
def->extensions = extensions;
|
||||
def->tagRegexTable = dosTagRegexTable;
|
||||
def->tagRegexCount = ARRAY_SIZE (dosTagRegexTable);
|
||||
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
|
||||
def->selectLanguage = selectors;
|
||||
return def;
|
||||
}
|
||||
@ -632,6 +632,7 @@ ctags = static_library('ctags',
|
||||
'ctags/parsers/cxx/cxx_token_chain.h',
|
||||
'ctags/parsers/cxx/cxx_token.h',
|
||||
'ctags/parsers/diff.c',
|
||||
'ctags/parsers/dosbatch.c',
|
||||
'ctags/parsers/erlang.c',
|
||||
'ctags/parsers/flex.c',
|
||||
'ctags/parsers/fortran.c',
|
||||
|
||||
@ -180,7 +180,7 @@ static void init_builtin_filetypes(void)
|
||||
FT_INIT( FORTH, NONE, "Forth", NULL, SOURCE_FILE, SCRIPT );
|
||||
FT_INIT( ASCIIDOC, ASCIIDOC, "Asciidoc", NULL, SOURCE_FILE, MARKUP );
|
||||
FT_INIT( ABAQUS, ABAQUS, "Abaqus", NULL, SOURCE_FILE, SCRIPT );
|
||||
FT_INIT( BATCH, NONE, "Batch", NULL, SCRIPT, SCRIPT );
|
||||
FT_INIT( BATCH, BATCH, "Batch", NULL, SCRIPT, SCRIPT );
|
||||
FT_INIT( POWERSHELL, POWERSHELL, "PowerShell", NULL, SOURCE_FILE, SCRIPT );
|
||||
FT_INIT( RUST, RUST, "Rust", NULL, SOURCE_FILE, COMPILED );
|
||||
FT_INIT( COFFEESCRIPT, NONE, "CoffeeScript", NULL, SOURCE_FILE, SCRIPT );
|
||||
|
||||
@ -1068,6 +1068,15 @@ static TMParserMapGroup group_ADA[] = {
|
||||
{_("Other"), TM_ICON_MEMBER, tm_tag_member_t | tm_tag_enumerator_t},
|
||||
};
|
||||
|
||||
static TMParserMapEntry map_BATCH[] = {
|
||||
{'l', tm_tag_other_t}, // label
|
||||
{'v', tm_tag_variable_t}, // variable
|
||||
};
|
||||
static TMParserMapGroup group_BATCH[] = {
|
||||
{_("Labels"), TM_ICON_OTHER, tm_tag_other_t},
|
||||
{_("Variables"), TM_ICON_VAR, tm_tag_variable_t},
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TMParserMapEntry *entries;
|
||||
@ -1138,6 +1147,7 @@ static TMParserMap parser_map[] = {
|
||||
MAP_ENTRY(CLOJURE),
|
||||
MAP_ENTRY(LISP),
|
||||
MAP_ENTRY(TYPESCRIPT),
|
||||
MAP_ENTRY(BATCH),
|
||||
};
|
||||
/* make sure the parser map is consistent and complete */
|
||||
G_STATIC_ASSERT(G_N_ELEMENTS(parser_map) == TM_PARSER_COUNT);
|
||||
|
||||
@ -116,6 +116,7 @@ enum
|
||||
TM_PARSER_CLOJURE,
|
||||
TM_PARSER_LISP,
|
||||
TM_PARSER_TYPESCRIPT,
|
||||
TM_PARSER_BATCH,
|
||||
TM_PARSER_COUNT
|
||||
};
|
||||
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
TclOOParser, \
|
||||
ClojureParser, \
|
||||
LispParser, \
|
||||
TypeScriptParser
|
||||
TypeScriptParser, \
|
||||
DosBatchParser
|
||||
|
||||
#endif
|
||||
|
||||
@ -295,6 +295,7 @@ test_sources = \
|
||||
simple.abc \
|
||||
simple.asciidoc \
|
||||
simple.bas \
|
||||
simple.bat \
|
||||
simple.clj \
|
||||
simple.conf \
|
||||
simple.d \
|
||||
|
||||
30
tests/ctags/simple.bat
Normal file
30
tests/ctags/simple.bat
Normal file
@ -0,0 +1,30 @@
|
||||
REM USAGE: geany-run-helper DIRECTORY AUTOCLOSE COMMAND...
|
||||
|
||||
REM unnecessary, but we get the directory
|
||||
cd %1
|
||||
shift
|
||||
REM save autoclose option and remove it
|
||||
set autoclose=%1
|
||||
shift
|
||||
|
||||
REM spawn the child
|
||||
REM it's tricky because shift doesn't affect %*, so hack it out
|
||||
REM https://en.wikibooks.org/wiki/Windows_Batch_Scripting#Command-line_arguments
|
||||
set SPAWN=
|
||||
:argloop
|
||||
if -%1-==-- goto argloop_end
|
||||
set SPAWN=%SPAWN% %1
|
||||
shift
|
||||
goto argloop
|
||||
:argloop_end
|
||||
%SPAWN%
|
||||
|
||||
REM show the result
|
||||
echo:
|
||||
echo:
|
||||
echo:------------------
|
||||
echo:(program exited with code: %ERRORLEVEL%)
|
||||
echo:
|
||||
|
||||
REM and if wanted, wait on the user
|
||||
if not %autoclose%==1 pause
|
||||
8
tests/ctags/simple.bat.tags
Normal file
8
tests/ctags/simple.bat.tags
Normal file
@ -0,0 +1,8 @@
|
||||
SPAWNÌ16384Ö0
|
||||
variable: SPAWN
|
||||
argloopÌ524288Ö0
|
||||
other: argloop
|
||||
argloop_endÌ524288Ö0
|
||||
other: argloop_end
|
||||
autocloseÌ16384Ö0
|
||||
variable: autoclose
|
||||
@ -292,6 +292,7 @@ ctags_tests = files([
|
||||
'ctags/simple.abc.tags',
|
||||
'ctags/simple.asciidoc.tags',
|
||||
'ctags/simple.bas.tags',
|
||||
'ctags/simple.bat.tags',
|
||||
'ctags/simple.clj.tags',
|
||||
'ctags/simple.conf.tags',
|
||||
'ctags/simple.d.tags',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user