Skip to content

Commit 6181b0b

Browse files
committed
Add Error type to lexer tokens
1 parent 77effe8 commit 6181b0b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/puppet-lint/lexer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def heredoc_queue
123123
[:WHITESPACE, %r{\A(#{WHITESPACE_RE}+)}],
124124
# FIXME: Future breaking change, the following :TYPE tokens conflict with
125125
# the :TYPE keyword token.
126-
[:TYPE, %r{\A(Integer|Float|Boolean|Regexp|String|Array|Hash|Resource|Class|Collection|Scalar|Numeric|CatalogEntry|Data|Tuple|Struct|Optional|NotUndef|Variant|Enum|Pattern|Any|Callable|Type|Runtime|Undef|Default|Sensitive)\b}], # rubocop:disable Layout/LineLength
126+
[:TYPE, %r{\A(Integer|Float|Boolean|Regexp|String|Array|Hash|Resource|Class|Collection|Scalar|Numeric|CatalogEntry|Data|Tuple|Struct|Optional|NotUndef|Variant|Enum|Pattern|Any|Callable|Type|Runtime|Undef|Default|Sensitive|Error)\b}], # rubocop:disable Layout/LineLength
127127
[:CLASSREF, %r{\A(((::){0,1}[A-Z][-\w]*)+)}],
128128
[:NUMBER, %r{\A\b((?:0[xX][0-9A-Fa-f]+|0?\d+(?:\.\d+)?(?:[eE]-?\d+)?))\b}],
129129
[:FUNCTION_NAME, %r{#{NAME_RE}(?=\()}],

spec/unit/puppet-lint/lexer_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,12 @@
13901390
expect(token.value).to eq('Sensitive')
13911391
end
13921392
end
1393+
1394+
it 'matches Error type' do
1395+
token = lexer.tokenise('Error').first
1396+
expect(token.type).to eq(:TYPE)
1397+
expect(token.value).to eq('Error')
1398+
end
13931399
end
13941400

13951401
context ':HEREDOC without interpolation' do

0 commit comments

Comments
 (0)