Skip to content

Commit

Permalink
PuppetManifest,Units: turn on autoFQ
Browse files Browse the repository at this point in the history
@ahakanbaba suggests specifying :: as default scope separator.

Clsoe universal-ctags#1916.
  • Loading branch information
masatake committed Jan 28, 2019
1 parent 67d954b commit f570d51
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
base input.pp /^class base {$/;" class line:3 language:PuppetManifest end:5
/tmp/classheir1 input.pp /^ file { "\/tmp\/classheir1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:base end:4
/tmp/classheir1 input.pp /^ file { "\/tmp\/classheir1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:::base end:4
sub1 input.pp /^class sub1 inherits base {$/;" class line:7 language:PuppetManifest end:9
/tmp/classheir2 input.pp /^ file { "\/tmp\/classheir2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:sub1 end:8
/tmp/classheir2 input.pp /^ file { "\/tmp\/classheir2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:::sub1 end:8
sub2 input.pp /^class sub2 inherits base {$/;" class line:11 language:PuppetManifest end:13
/tmp/classheir3 input.pp /^ file { "\/tmp\/classheir3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:sub2 end:12
/tmp/classheir3 input.pp /^ file { "\/tmp\/classheir3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:::sub2 end:12
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base input.pp /^class base {$/;" class line:3 language:PuppetManifest end:5
/tmp/classincludes1 input.pp /^ file { "\/tmp\/classincludes1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:base end:4
/tmp/classincludes1 input.pp /^ file { "\/tmp\/classincludes1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:::base end:4
sub1 input.pp /^class sub1 inherits base {$/;" class line:7 language:PuppetManifest end:9
/tmp/classincludes2 input.pp /^ file { "\/tmp\/classincludes2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:sub1 end:8
/tmp/classincludes2 input.pp /^ file { "\/tmp\/classincludes2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:::sub1 end:8
sub2 input.pp /^class sub2 inherits base {$/;" class line:11 language:PuppetManifest end:13
/tmp/classincludes3 input.pp /^ file { "\/tmp\/classincludes3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:sub2 end:12
/tmp/classincludes3 input.pp /^ file { "\/tmp\/classincludes3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:::sub2 end:12
sub input.pp /^$sub = "sub2"$/;" variable line:15 language:PuppetManifest
10 changes: 5 additions & 5 deletions Units/parser-puppetManifest.r/puppet-classname.d/expected.tags
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
t input.pp /^class t {$/;" class line:1 language:PuppetManifest end:3
/tmp/multipleclasst input.pp /^ file { "\/tmp\/multipleclasst": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:t end:2
/tmp/multipleclasst input.pp /^ file { "\/tmp\/multipleclasst": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:::t end:2
one_ input.pp /^class one_ {$/;" class line:5 language:PuppetManifest end:7
/tmp/multipleclassone_ input.pp /^ file { "\/tmp\/multipleclassone_": content => "one" }$/;" resource line:6 language:PuppetManifest scope:class:one_ end:6
/tmp/multipleclassone_ input.pp /^ file { "\/tmp\/multipleclassone_": content => "one" }$/;" resource line:6 language:PuppetManifest scope:class:::one_ end:6
on_e input.pp /^class on_e {$/;" class line:9 language:PuppetManifest end:11
/tmp/multipleclasson_e input.pp /^ file { "\/tmp\/multipleclasson_e": content => "one" }$/;" resource line:10 language:PuppetManifest scope:class:on_e end:10
/tmp/multipleclasson_e input.pp /^ file { "\/tmp\/multipleclasson_e": content => "one" }$/;" resource line:10 language:PuppetManifest scope:class:::on_e end:10
o_ne::tw_o input.pp /^class o_ne::tw_o {$/;" class line:14 language:PuppetManifest end:16
/tmp/multipleclasso_netw_o input.pp /^ file { "\/tmp\/multipleclasso_netw_o": content => "two" }$/;" resource line:15 language:PuppetManifest scope:class:o_ne::tw_o end:15
/tmp/multipleclasso_netw_o input.pp /^ file { "\/tmp\/multipleclasso_netw_o": content => "two" }$/;" resource line:15 language:PuppetManifest scope:class:::o_ne::tw_o end:15
o_ne::two_ input.pp /^class o_ne::two_ {$/;" class line:18 language:PuppetManifest end:20
/tmp/multipleclasso_netwo_ input.pp /^ file { "\/tmp\/multipleclasso_netwo_": content => "two" }$/;" resource line:19 language:PuppetManifest scope:class:o_ne::two_ end:19
/tmp/multipleclasso_netwo_ input.pp /^ file { "\/tmp\/multipleclasso_netwo_": content => "two" }$/;" resource line:19 language:PuppetManifest scope:class:::o_ne::two_ end:19
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mytype input.pp /^define mytype {$/;" definition line:3 language:PuppetManifest end:5
/tmp/classtest input.pp /^ file { "\/tmp\/classtest": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:definition:mytype end:4
testing input.pp /^class testing {$/;" class line:7 language:PuppetManifest end:9
componentname input.pp /^ mytype { "componentname": }$/;" resource line:8 language:PuppetManifest scope:class:testing end:8
componentname input.pp /^ mytype { "componentname": }$/;" resource line:8 language:PuppetManifest scope:class:::testing end:8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
one input.pp /^class one {$/;" class line:1 language:PuppetManifest end:4
/tmp/colltest1 input.pp /^ @file { "\/tmp\/colltest1": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:one end:2
/tmp/colltest2 input.pp /^ @file { "\/tmp\/colltest2": content => "two" }$/;" resource line:3 language:PuppetManifest scope:class:one end:3
/tmp/colltest1 input.pp /^ @file { "\/tmp\/colltest1": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:::one end:2
/tmp/colltest2 input.pp /^ @file { "\/tmp\/colltest2": content => "two" }$/;" resource line:3 language:PuppetManifest scope:class:::one end:3
two input.pp /^class two {$/;" class line:6 language:PuppetManifest end:8
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
base input.pp /^class base {$/;" class line:3 language:PuppetManifest end:5
/tmp/deepclassheir1 input.pp /^ file { "\/tmp\/deepclassheir1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:base end:4
/tmp/deepclassheir1 input.pp /^ file { "\/tmp\/deepclassheir1": ensure => file, mode => '0755' }$/;" resource line:4 language:PuppetManifest scope:class:::base end:4
sub1 input.pp /^class sub1 inherits base {$/;" class line:7 language:PuppetManifest end:9
/tmp/deepclassheir2 input.pp /^ file { "\/tmp\/deepclassheir2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:sub1 end:8
/tmp/deepclassheir2 input.pp /^ file { "\/tmp\/deepclassheir2": ensure => file, mode => '0755' }$/;" resource line:8 language:PuppetManifest scope:class:::sub1 end:8
sub2 input.pp /^class sub2 inherits sub1 {$/;" class line:11 language:PuppetManifest end:13
/tmp/deepclassheir3 input.pp /^ file { "\/tmp\/deepclassheir3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:sub2 end:12
/tmp/deepclassheir3 input.pp /^ file { "\/tmp\/deepclassheir3": ensure => file, mode => '0755' }$/;" resource line:12 language:PuppetManifest scope:class:::sub2 end:12
sub3 input.pp /^class sub3 inherits sub2 {$/;" class line:15 language:PuppetManifest end:17
/tmp/deepclassheir4 input.pp /^ file { "\/tmp\/deepclassheir4": ensure => file, mode => '0755' }$/;" resource line:16 language:PuppetManifest scope:class:sub3 end:16
/tmp/deepclassheir4 input.pp /^ file { "\/tmp\/deepclassheir4": ensure => file, mode => '0755' }$/;" resource line:16 language:PuppetManifest scope:class:::sub3 end:16
sub4 input.pp /^class sub4 inherits sub3 {$/;" class line:19 language:PuppetManifest end:21
/tmp/deepclassheir5 input.pp /^ file { "\/tmp\/deepclassheir5": ensure => file, mode => '0755' }$/;" resource line:20 language:PuppetManifest scope:class:sub4 end:20
/tmp/deepclassheir5 input.pp /^ file { "\/tmp\/deepclassheir5": ensure => file, mode => '0755' }$/;" resource line:20 language:PuppetManifest scope:class:::sub4 end:20
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
base input.pp /^class base {$/;" class line:1 language:PuppetManifest end:5
one input.pp /^ class one {$/;" class line:2 language:PuppetManifest scope:class:base end:4
/tmp/fqparent1 input.pp /^ file { "\/tmp\/fqparent1": ensure => file }$/;" resource line:3 language:PuppetManifest scope:class:base.one end:3
one input.pp /^ class one {$/;" class line:2 language:PuppetManifest scope:class:::base end:4
/tmp/fqparent1 input.pp /^ file { "\/tmp\/fqparent1": ensure => file }$/;" resource line:3 language:PuppetManifest scope:class:::base::one end:3
two::three input.pp /^class two::three inherits base::one {$/;" class line:7 language:PuppetManifest end:9
/tmp/fqparent2 input.pp /^ file { "\/tmp\/fqparent2": ensure => file }$/;" resource line:8 language:PuppetManifest scope:class:two::three end:8
/tmp/fqparent2 input.pp /^ file { "\/tmp\/fqparent2": ensure => file }$/;" resource line:8 language:PuppetManifest scope:class:::two::three end:8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
one input.pp /^class one {$/;" class line:1 language:PuppetManifest end:3
/tmp/multipleclassone input.pp /^ file { "\/tmp\/multipleclassone": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:one end:2
/tmp/multipleclassone input.pp /^ file { "\/tmp\/multipleclassone": content => "one" }$/;" resource line:2 language:PuppetManifest scope:class:::one end:2
two input.pp /^class two {$/;" class line:5 language:PuppetManifest end:7
/tmp/multipleclasstwo input.pp /^ file { "\/tmp\/multipleclasstwo": content => "two" }$/;" resource line:6 language:PuppetManifest scope:class:two end:6
/tmp/multipleclasstwo input.pp /^ file { "\/tmp\/multipleclasstwo": content => "two" }$/;" resource line:6 language:PuppetManifest scope:class:::two end:6
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
base input.pp /^class base {$/;" class line:1 language:PuppetManifest end:3
/tmp/multisubtest input.pp /^ file { "\/tmp\/multisubtest": content => "base", mode => '0644' }$/;" resource line:2 language:PuppetManifest scope:class:base end:2
/tmp/multisubtest input.pp /^ file { "\/tmp\/multisubtest": content => "base", mode => '0644' }$/;" resource line:2 language:PuppetManifest scope:class:::base end:2
sub1 input.pp /^class sub1 inherits base {$/;" class line:5 language:PuppetManifest end:6
sub2 input.pp /^class sub2 inherits base {$/;" class line:9 language:PuppetManifest end:10
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mode input.pp /^$mode = "640"$/;" variable line:2 language:PuppetManifest
thing input.pp /^define thing {$/;" definition line:4 language:PuppetManifest end:6
/tmp/$name input.pp /^ file { "\/tmp\/$name": ensure => file, mode => $mode }$/;" resource line:5 language:PuppetManifest scope:definition:thing end:5
testing input.pp /^class testing {$/;" class line:8 language:PuppetManifest end:11
mode input.pp /^ $mode = "755"$/;" variable line:9 language:PuppetManifest scope:class:testing
mode input.pp /^ $mode = "755"$/;" variable line:9 language:PuppetManifest scope:class:::testing
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
one::fake input.pp /^class one::fake {$/;" class line:3 language:PuppetManifest end:5
/tmp/subclass_name_duplication1 input.pp /^ file { "\/tmp\/subclass_name_duplication1": ensure => present }$/;" resource line:4 language:PuppetManifest scope:class:one::fake end:4
/tmp/subclass_name_duplication1 input.pp /^ file { "\/tmp\/subclass_name_duplication1": ensure => present }$/;" resource line:4 language:PuppetManifest scope:class:::one::fake end:4
two::fake input.pp /^class two::fake {$/;" class line:7 language:PuppetManifest end:9
/tmp/subclass_name_duplication2 input.pp /^ file { "\/tmp\/subclass_name_duplication2": ensure => present }$/;" resource line:8 language:PuppetManifest scope:class:two::fake end:8
/tmp/subclass_name_duplication2 input.pp /^ file { "\/tmp\/subclass_name_duplication2": ensure => present }$/;" resource line:8 language:PuppetManifest scope:class:::two::fake end:8
1 change: 1 addition & 0 deletions Units/parser-puppetManifest.r/root-sep.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--extras=+q
4 changes: 4 additions & 0 deletions Units/parser-puppetManifest.r/root-sep.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/tmp/classheir1 input.pp /^ file { "\/tmp\/classheir1": ensure => file, mode => '0755' }$/;" r class:::base
::base input.pp /^class base {$/;" c
::base::/tmp/classheir1 input.pp /^ file { "\/tmp\/classheir1": ensure => file, mode => '0755' }$/;" r class:::base
base input.pp /^class base {$/;" c
6 changes: 6 additions & 0 deletions Units/parser-puppetManifest.r/root-sep.d/input.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class base {
file { "/tmp/classheir1": ensure => file, mode => '0755' }
}

include base

16 changes: 16 additions & 0 deletions optlib/puppetManifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
#include "xtag.h"


typedef enum {
K_CLASS,
K_DEFINITION,
K_NODE,
K_RESOURCE,
K_VARIABLE,
} PuppetManifestKind;


static void initializePuppetManifestParser (const langType language)
{

Expand Down Expand Up @@ -603,9 +612,14 @@ extern parserDefinition* PuppetManifestParser (void)
NULL
};

static scopeSeparator PuppetManifestClassSeparators [] = {
{ KIND_GHOST_INDEX, "::" },
};

static kindDefinition PuppetManifestKindTable [] = {
{
true, 'c', "class", "classes",
ATTACH_SEPARATORS(PuppetManifestClassSeparators),
},
{
true, 'd', "definition", "definitions",
Expand All @@ -631,6 +645,8 @@ extern parserDefinition* PuppetManifestParser (void)
def->useCork = 1;
def->kindTable = PuppetManifestKindTable;
def->kindCount = ARRAY_SIZE(PuppetManifestKindTable);
def->requestAutomaticFQTag = true;
def->defaultScopeSeparator = "::";
def->initialize = initializePuppetManifestParser;

return def;
Expand Down
8 changes: 7 additions & 1 deletion optlib/puppetManifest.ctags
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# - https://github.com/puppetlabs/puppet-specifications/blob/master/language/intro.md
# - https://docs.puppet.com/puppet/5.1/lang_visual_index.html
#
--langdef=PuppetManifest
--langdef=PuppetManifest{_autoFQTag}
--map-PuppetManifest=+.pp

#
Expand All @@ -39,6 +39,12 @@
--kinddef-PuppetManifest=r,resource,resources
--kinddef-PuppetManifest=v,variable,variables

#
# Separators
#
--_scopesep-PuppetManifest=/c:::
--_scopesep-PuppetManifest=*/*:::

#
# Tables
#
Expand Down

0 comments on commit f570d51

Please sign in to comment.