Skip to content

Commit

Permalink
PuppetManifest: optimize the way to handle string literals more
Browse files Browse the repository at this point in the history
Releated to universal-ctags#1912.
example.pp.zip submitted to universal-ctags#1921 is used to take a benchmark.

Before:
[yamato@master]~/var/ctags-github% time ./ctags --verbose /tmp/example.pp > /tmp/LOG 2>&1
./ctags --verbose /tmp/example.pp > /tmp/LOG 2>&1  4.48s user 1.01s system 99% cpu 5.498 total

After:
[yamato@master]~/var/ctags-github% time ./ctags --verbose /tmp/example.pp > /tmp/LOG 2>&1
./ctags --verbose /tmp/example.pp > /tmp/LOG 2>&1  3.46s user 0.84s system 99% cpu 4.312 total

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Oct 9, 2018
1 parent 78fe1fd commit e7210e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions optlib/puppetManifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ static void initializePuppetManifestParser (const langType language CTAGS_ATTR_U
addLanguageTagMultiTableRegex (language, "endWithPop",
"^",
"", "", "{tleave}{scope=pop}", NULL);
addLanguageTagMultiTableRegex (language, "ssliteral",
"^[^']*'",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "ssliteral",
"^[^']+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "ssliteral",
"^'",
addLanguageTagMultiTableRegex (language, "dsliteral",
"^[^\"]*\"",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "dsliteral",
"^[^\"]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "dsliteral",
"^\"",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "comment",
"^/\\*",
"", "", "{tenter=comment_multiline}", NULL);
Expand Down
4 changes: 2 additions & 2 deletions optlib/puppetManifest.ctags
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@
--_mtable-regex-PuppetManifest=end///{tleave}
--_mtable-regex-PuppetManifest=endWithPop///{tleave}{scope=pop}

--_mtable-regex-PuppetManifest=ssliteral/[^']*'//{tleave}
--_mtable-regex-PuppetManifest=ssliteral/[^']+//
--_mtable-regex-PuppetManifest=ssliteral/'//{tleave}
--_mtable-regex-PuppetManifest=dsliteral/[^"]*"//{tleave}
--_mtable-regex-PuppetManifest=dsliteral/[^"]+//
--_mtable-regex-PuppetManifest=dsliteral/"//{tleave}

#
# comment
Expand Down

0 comments on commit e7210e2

Please sign in to comment.