You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/lib/puppet-lint/lexer.rb b/lib/puppet-lint/lexer.rb
index e9d1696..7cf3fbe 100644
--- a/lib/puppet-lint/lexer.rb
+++ b/lib/puppet-lint/lexer.rb
@@ -211,6 +211,8 @@ class PuppetLint
value = chunk[regex, 1]
next if value.nil?
+ next if type == :FUNCTION_NAME && tokens.size > 1 && ['class', 'define'].include?(tokens[-2].value)
+
i += value.size
tokens << if type == :NAME && KEYWORDS.include?(value)
new_token(value.upcase.to_sym, value)
But IMHO even if the added check for 'does this token follow a class or define keyword?' is cleaned up (by moving it to a separate function and making it less ad hoc) it would still stick out as a strange special case from the tokenizing procedure.
OOC, do you have a case at hand where this misparsing leads to a specific error?
No errors per se, but i was writing a linter that adds or removes whitespace at certain locations, eg. in front of a parenthesis. Consensus seems to be that a space should not be put between a function call and its opening parenthesis, but should be put after a class name (as in the example).
Example for the function call: $x = sum($y) (no space)
When I provide the lexer with this code, it will detect
myclass
as typeFUNCTION_NAME
, due to the missing space betweenmyclass
and theLPAREN
:I expect this to be type
NAME
, same as when I would provide this:The text was updated successfully, but these errors were encountered: