Skip to content

Commit

Permalink
Detect file import on pp disambiguation
Browse files Browse the repository at this point in the history
It's a convention used by some Puppet modules to have nothing on "init.pp"
except imports of class and definition files. Though some Pascal versions
seems to use import as well, Puppet's import are followed by glob patterns
inside double quotes, while Pascal's import are followed by identifiers.

Use imports followed by double quotes to detect these files as Puppet
files.
  • Loading branch information
dcsobral committed Dec 13, 2012
1 parent 61d9bcf commit bdfa6dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/detector.c
Expand Up @@ -797,7 +797,7 @@ const char *disambiguate_pp(SourceFile *sourcefile) {

/* check for standard puppet constructs */
pcre *construct;
construct = pcre_compile("^\\s*(define\\s+[\\w:-]+\\s*\\(|class\\s+[\\w:-]+(\\s+inherits\\s+[\\w:-]+)?\\s*{|node\\s+\\'?[\\w:\\.-]+\\'?\\s*{)",
construct = pcre_compile("^\\s*(define\\s+[\\w:-]+\\s*\\(|class\\s+[\\w:-]+(\\s+inherits\\s+[\\w:-]+)?\\s*{|node\\s+\\'?[\\w:\\.-]+\\'?\\s*{|import\\s+\")",
PCRE_MULTILINE, &error, &erroffset, NULL);

if (pcre_exec(construct, NULL, p, mystrnlen(p, 10000), 0, 0, NULL, 0) > -1)
Expand Down

0 comments on commit bdfa6dc

Please sign in to comment.