Skip to content

Commit 25825df

Browse files
authoredMar 19, 2025··
Merge pull request #240 from kenyon/add-abstract-data-types
Add abstract data types to lexer type tokens list
2 parents b44f264 + a9aa0e0 commit 25825df

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
 

‎lib/puppet-lint/lexer.rb

+38-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,44 @@ 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(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
126+
[:TYPE, %r{\A(
127+
Any|
128+
Array|
129+
Binary|
130+
Boolean|
131+
Callable|
132+
CatalogEntry|
133+
Class|
134+
Collection|
135+
Data|
136+
Default|
137+
Enum|
138+
Error|
139+
Float|
140+
Hash|
141+
Integer|
142+
Iterable|
143+
Iterator|
144+
NotUndef|
145+
Numeric|
146+
Optional|
147+
Pattern|
148+
Regexp|
149+
Resource|
150+
RichData|
151+
Runtime|
152+
Scalar|
153+
ScalarData|
154+
SemVer|
155+
SemVerRange|
156+
Sensitive|
157+
String|
158+
Struct|
159+
Tuple|
160+
Type|
161+
Undef|
162+
Variant
163+
)\b}x],
127164
[:CLASSREF, %r{\A(((::){0,1}[A-Z][-\w]*)+)}],
128165
[:NUMBER, %r{\A\b((?:0[xX][0-9A-Fa-f]+|0?\d+(?:\.\d+)?(?:[eE]-?\d+)?))\b}],
129166
[:FUNCTION_NAME, %r{#{NAME_RE}(?=\()}],

‎spec/unit/puppet-lint/lexer_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,12 @@
13921392

13931393
it_behaves_like 'a type matcher', 'Error'
13941394
it_behaves_like 'a type matcher', 'Binary'
1395+
it_behaves_like 'a type matcher', 'Iterable'
1396+
it_behaves_like 'a type matcher', 'Iterator'
1397+
it_behaves_like 'a type matcher', 'RichData'
1398+
it_behaves_like 'a type matcher', 'ScalarData'
1399+
it_behaves_like 'a type matcher', 'SemVer'
1400+
it_behaves_like 'a type matcher', 'SemVerRange'
13951401
end
13961402

13971403
context ':HEREDOC without interpolation' do

0 commit comments

Comments
 (0)
Please sign in to comment.