Skip to content

Commit

Permalink
Add Binary type to lexer type tokens list
Browse files Browse the repository at this point in the history
  • Loading branch information
jay7x authored and Yury Bushmelev committed Dec 3, 2024
1 parent 167ab94 commit a0fc8ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def heredoc_queue
[:WHITESPACE, %r{\A(#{WHITESPACE_RE}+)}],
# FIXME: Future breaking change, the following :TYPE tokens conflict with
# the :TYPE keyword token.
[:TYPE, %r{\A(Any|Array|Boolean|Callable|CatalogEntry|Class|Collection|Data|Default|Enum|Error|Float|Hash|Integer|NotUndef|Numeric|Optional|Pattern|Regexp|Resource|Runtime|Scalar|Sensitive|String|Struct|Tuple|Type|Undef|Variant)\b}], # rubocop:disable Layout/LineLength
[:TYPE, %r{\A(Any|Array|Binary|Boolean|Callable|CatalogEntry|Class|Collection|Data|Default|Enum|Error|Float|Hash|Integer|NotUndef|Numeric|Optional|Pattern|Regexp|Resource|Runtime|Scalar|Sensitive|String|Struct|Tuple|Type|Undef|Variant)\b}], # rubocop:disable Layout/LineLength
[:CLASSREF, %r{\A(((::){0,1}[A-Z][-\w]*)+)}],
[:NUMBER, %r{\A\b((?:0[xX][0-9A-Fa-f]+|0?\d+(?:\.\d+)?(?:[eE]-?\d+)?))\b}],
[:FUNCTION_NAME, %r{#{NAME_RE}(?=\()}],
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/puppet-lint/lexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,12 @@
expect(token.type).to eq(:TYPE)
expect(token.value).to eq('Error')
end

it 'matches Binary type' do
token = lexer.tokenise('Binary').first
expect(token.type).to eq(:TYPE)
expect(token.value).to eq('Binary')
end
end

context ':HEREDOC without interpolation' do
Expand Down

0 comments on commit a0fc8ff

Please sign in to comment.