Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Units/simple-gomod.d/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The input.gomod is taken from https://github.com/netmute/ctags-lsp.git .
2 changes: 2 additions & 0 deletions Units/simple-gomod.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--sort=no
--map-GoMod=+.gomod
1 change: 1 addition & 0 deletions Units/simple-gomod.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github.com/netmute/ctags-lsp input.gomod /^module github.com\/netmute\/ctags-lsp$/;" m
3 changes: 3 additions & 0 deletions Units/simple-gomod.d/input.gomod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/netmute/ctags-lsp

go 1.23.2
1 change: 1 addition & 0 deletions docs/news/HEAD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The following parsers have been added:
* Netfilter: to handle the output of "nft list ..." command
* Prolog
* DBusService
* GoMod

Changes about parser specific kinds, roles, fields, and extras
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions main/parsers_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
GDScriptParser, \
GemSpecParser, \
GoParser, \
GoModParser, \
GPerfParser, \
HaskellParser, \
HaxeParser, \
Expand Down
62 changes: 62 additions & 0 deletions optlib/gomod.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Generated by ./misc/optlib2c from optlib/gomod.ctags, Don't edit this manually.
*/
#include "general.h"
#include "parse.h"
#include "routines.h"
#include "field.h"
#include "xtag.h"


static void initializeGoModParser (const langType language)
{

addLanguageRegexTable (language, "main");

addLanguageTagMultiTableRegex (language, "main",
"^module[ \t]+([^ \t\n]+)([\n]|)",
"\\1", "m", "", NULL);
addLanguageTagMultiTableRegex (language, "main",
"^[^\n]*[\n]",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "main",
"^.",
"", "", "", NULL);
}

extern parserDefinition* GoModParser (void)
{
static const char *const extensions [] = {
NULL
};

static const char *const aliases [] = {
NULL
};

static const char *const patterns [] = {
"go.mod",
NULL
};

static kindDefinition GoModKindTable [] = {
{
true, 'm', "module", "modules",
},
};

parserDefinition* const def = parserNew ("GoMod");

def->versionCurrent= 0;
def->versionAge = 0;
def->enabled = true;
def->extensions = extensions;
def->patterns = patterns;
def->aliases = aliases;
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
def->kindTable = GoModKindTable;
def->kindCount = ARRAY_SIZE(GoModKindTable);
def->initialize = initializeGoModParser;

return def;
}
32 changes: 32 additions & 0 deletions optlib/gomod.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (c) 2025, Red Hat, Inc.
# Copyright (c) 2025, Masatake YAMATO
#
# Author: Masatake YAMATO <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# Reference:
# https://go.dev/doc/modules/gomod-ref
#
--langdef=GoMod
--map-GoMod=+(go.mod)
--kinddef-GoMod=m,module,modules

--_tabledef-GoMod=main
--_mtable-regex-GoMod=main/module[ \t]+([^ \t\n]+)([\n]|)/\1/m/
--_mtable-regex-GoMod=main/[^\n]*[\n]//
--_mtable-regex-GoMod=main/.//
1 change: 1 addition & 0 deletions source.mak
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ OPTLIB2C_INPUT = \
optlib/elixir.ctags \
optlib/forth.ctags \
optlib/gdbinit.ctags \
optlib/gomod.ctags \
optlib/gperf.ctags \
optlib/inko.ctags \
optlib/iPythonCell.ctags \
Expand Down
1 change: 1 addition & 0 deletions win32/ctags_vs2013.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
<ClCompile Include="..\optlib\elixir.c" />
<ClCompile Include="..\optlib\forth.c" />
<ClCompile Include="..\optlib\gdbinit.c" />
<ClCompile Include="..\optlib\gomod.c" />
<ClCompile Include="..\optlib\gperf.c" />
<ClCompile Include="..\optlib\iPythonCell.c" />
<ClCompile Include="..\optlib\inko.c" />
Expand Down
3 changes: 3 additions & 0 deletions win32/ctags_vs2013.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
<ClCompile Include="..\optlib\gdbinit.c">
<Filter>Source Files\optlib</Filter>
</ClCompile>
<ClCompile Include="..\optlib\gomod.c">
<Filter>Source Files\optlib</Filter>
</ClCompile>
<ClCompile Include="..\optlib\gperf.c">
<Filter>Source Files\optlib</Filter>
</ClCompile>
Expand Down
Loading