packwerk 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packwerk/association_inspector.rb +17 -4
  3. data/lib/packwerk/checker.rb +3 -3
  4. data/lib/packwerk/configuration.rb +4 -0
  5. data/lib/packwerk/const_node_inspector.rb +2 -2
  6. data/lib/packwerk/constant_name_inspector.rb +2 -2
  7. data/lib/packwerk/offenses_formatter.rb +3 -3
  8. data/lib/packwerk/package.rb +1 -1
  9. data/lib/packwerk/package_todo.rb +1 -4
  10. data/lib/packwerk/parsers/factory.rb +3 -3
  11. data/lib/packwerk/parsers/ruby.rb +7 -0
  12. data/lib/packwerk/reference_extractor.rb +29 -1
  13. data/lib/packwerk/reference_offense.rb +1 -1
  14. data/lib/packwerk/run_context.rb +15 -4
  15. data/lib/packwerk/validator.rb +3 -3
  16. data/lib/packwerk/version.rb +1 -1
  17. data/lib/packwerk.rb +1 -0
  18. data/sorbet/config +1 -0
  19. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +3280 -3450
  20. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +2322 -1782
  21. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +2654 -3268
  22. data/sorbet/rbi/gems/ast@2.4.2.rbi +535 -6
  23. data/sorbet/rbi/gems/better_html@2.0.1.rbi +529 -0
  24. data/sorbet/rbi/gems/builder@3.2.4.rbi +4 -4
  25. data/sorbet/rbi/gems/byebug@11.1.3.rbi +32 -4
  26. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +1750 -1840
  27. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +15 -15
  28. data/sorbet/rbi/gems/crass@1.0.6.rbi +489 -5
  29. data/sorbet/rbi/gems/erubi@1.11.0.rbi +24 -21
  30. data/sorbet/rbi/gems/i18n@1.12.0.rbi +395 -395
  31. data/sorbet/rbi/gems/json@2.6.2.rbi +70 -77
  32. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +1 -1
  33. data/sorbet/rbi/gems/loofah@2.18.0.rbi +134 -134
  34. data/sorbet/rbi/gems/m@1.6.0.rbi +60 -60
  35. data/sorbet/rbi/gems/method_source@1.1.0.rbi +303 -0
  36. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +22 -28
  37. data/sorbet/rbi/gems/minitest@5.16.2.rbi +384 -396
  38. data/sorbet/rbi/gems/mocha@1.14.0.rbi +589 -589
  39. data/sorbet/rbi/gems/netrc@0.11.0.rbi +37 -32
  40. data/sorbet/rbi/gems/nokogiri@1.15.3.rbi +962 -946
  41. data/sorbet/rbi/gems/{parallel@1.22.1.rbi → parallel@1.24.0.rbi} +85 -82
  42. data/sorbet/rbi/gems/{parser@3.2.2.0.rbi → parser@3.3.1.0.rbi} +1679 -1609
  43. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +1 -1
  44. data/sorbet/rbi/gems/{prism@0.24.0.rbi → prism@0.27.0.rbi} +13473 -6472
  45. data/sorbet/rbi/gems/{racc@1.6.0.rbi → racc@1.7.1.rbi} +42 -33
  46. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +148 -338
  47. data/sorbet/rbi/gems/rack@2.2.4.rbi +1079 -1130
  48. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +354 -22
  49. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +113 -259
  50. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +642 -638
  51. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +109 -99
  52. data/sorbet/rbi/gems/rake@13.0.6.rbi +714 -599
  53. data/sorbet/rbi/gems/{rbi@0.0.15.rbi → rbi@0.1.12.rbi} +865 -801
  54. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +853 -870
  55. data/sorbet/rbi/gems/rexml@3.2.5.rbi +480 -477
  56. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +1621 -1622
  57. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +507 -526
  58. data/sorbet/rbi/gems/rubocop-shopify@2.9.0.rbi +1 -1
  59. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +186 -203
  60. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +8126 -8367
  61. data/sorbet/rbi/gems/{ruby-lsp@0.2.1.rbi → ruby-lsp@0.2.3.rbi} +2 -2
  62. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1235 -4
  63. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +90 -90
  64. data/sorbet/rbi/gems/spoom@1.3.2.rbi +4420 -0
  65. data/sorbet/rbi/gems/spring@4.0.0.rbi +104 -104
  66. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +1 -1
  67. data/sorbet/rbi/gems/{tapioca@0.9.2.rbi → tapioca@0.13.3.rbi} +1596 -1253
  68. data/sorbet/rbi/gems/{thor@1.2.1.rbi → thor@1.3.1.rbi} +1047 -652
  69. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +531 -513
  70. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +13 -13
  71. data/sorbet/rbi/gems/{yard-sorbet@0.6.1.rbi → yard-sorbet@0.8.1.rbi} +132 -92
  72. data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.36.rbi} +3158 -3067
  73. data/sorbet/rbi/gems/zeitwerk@2.6.4.rbi +149 -145
  74. metadata +22 -94
  75. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
  76. data/.github/pull_request_template.md +0 -28
  77. data/.github/workflows/ci.yml +0 -93
  78. data/.github/workflows/cla.yml +0 -22
  79. data/.gitignore +0 -13
  80. data/.rubocop.yml +0 -75
  81. data/.ruby-version +0 -1
  82. data/CODEOWNERS +0 -1
  83. data/CODE_OF_CONDUCT.md +0 -76
  84. data/CONTRIBUTING.md +0 -17
  85. data/Gemfile +0 -27
  86. data/Gemfile.lock +0 -206
  87. data/RESOLVING_VIOLATIONS.md +0 -76
  88. data/Rakefile +0 -22
  89. data/TROUBLESHOOT.md +0 -44
  90. data/UPGRADING.md +0 -66
  91. data/USAGE.md +0 -364
  92. data/bin/console +0 -15
  93. data/bin/m +0 -29
  94. data/bin/rake +0 -29
  95. data/bin/rubocop +0 -29
  96. data/bin/setup +0 -8
  97. data/bin/srb +0 -29
  98. data/bin/tapioca +0 -29
  99. data/dev.yml +0 -32
  100. data/docs/cohesion.png +0 -0
  101. data/gemfiles/Gemfile-rails-6-0 +0 -22
  102. data/gemfiles/Gemfile-rails-6-1 +0 -22
  103. data/packwerk.gemspec +0 -59
  104. data/shipit.rubygems.yml +0 -5
  105. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +0 -2754
  106. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +0 -1496
  107. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +0 -2362
  108. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +0 -1569
  109. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +0 -2553
  110. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +0 -5999
  111. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +0 -37832
  112. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +0 -2321
  113. data/sorbet/rbi/gems/better_html@1.0.16.rbi +0 -317
  114. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  115. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1079
  116. data/sorbet/rbi/gems/digest@3.1.0.rbi +0 -189
  117. data/sorbet/rbi/gems/globalid@1.0.0.rbi +0 -572
  118. data/sorbet/rbi/gems/mail@2.7.1.rbi +0 -2490
  119. data/sorbet/rbi/gems/marcel@1.0.2.rbi +0 -220
  120. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -76
  121. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +0 -170
  122. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +0 -2147
  123. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +0 -926
  124. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +0 -11
  125. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +0 -1108
  126. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +0 -292
  127. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  128. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +0 -8
  129. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -2181
  130. data/sorbet/rbi/gems/strscan@3.0.4.rbi +0 -8
  131. data/sorbet/rbi/gems/timeout@0.3.0.rbi +0 -142
  132. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -4529
  133. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2582
  134. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +0 -993
  135. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -71
@@ -1,138 +1,622 @@
1
+ # typed: true
2
+
1
3
  # DO NOT EDIT MANUALLY
2
4
  # This is an autogenerated file for types exported from the `crass` gem.
3
- # Please instead update this file by running `dev typecheck update`.
4
-
5
- # typed: true
5
+ # Please instead update this file by running `bin/tapioca gem crass`.
6
6
 
7
+ # A CSS parser based on the CSS Syntax Module Level 3 spec.
8
+ #
9
+ # source://crass//lib/crass/token-scanner.rb#3
7
10
  module Crass
8
11
  class << self
12
+ # Parses _input_ as a CSS stylesheet and returns a parse tree.
13
+ #
14
+ # See {Tokenizer#initialize} for _options_.
15
+ #
16
+ # source://crass//lib/crass.rb#10
9
17
  def parse(input, options = T.unsafe(nil)); end
18
+
19
+ # Parses _input_ as a string of CSS properties (such as the contents of an
20
+ # HTML element's `style` attribute) and returns a parse tree.
21
+ #
22
+ # See {Tokenizer#initialize} for _options_.
23
+ #
24
+ # source://crass//lib/crass.rb#18
10
25
  def parse_properties(input, options = T.unsafe(nil)); end
11
26
  end
12
27
  end
13
28
 
29
+ # Parses a CSS string or list of tokens.
30
+ #
31
+ # 5. http://dev.w3.org/csswg/css-syntax/#parsing
32
+ #
33
+ # source://crass//lib/crass/parser.rb#10
14
34
  class Crass::Parser
35
+ # Initializes a parser based on the given _input_, which may be a CSS string
36
+ # or an array of tokens.
37
+ #
38
+ # See {Tokenizer#initialize} for _options_.
39
+ #
40
+ # @return [Parser] a new instance of Parser
41
+ #
42
+ # source://crass//lib/crass/parser.rb#126
15
43
  def initialize(input, options = T.unsafe(nil)); end
16
44
 
45
+ # Consumes an at-rule and returns it.
46
+ #
47
+ # 5.4.2. http://dev.w3.org/csswg/css-syntax-3/#consume-at-rule
48
+ #
49
+ # source://crass//lib/crass/parser.rb#137
17
50
  def consume_at_rule(input = T.unsafe(nil)); end
51
+
52
+ # Consumes a component value and returns it, or `nil` if there are no more
53
+ # tokens.
54
+ #
55
+ # 5.4.6. http://dev.w3.org/csswg/css-syntax-3/#consume-a-component-value
56
+ #
57
+ # source://crass//lib/crass/parser.rb#184
18
58
  def consume_component_value(input = T.unsafe(nil)); end
59
+
60
+ # Consumes a declaration and returns it, or `nil` on parse error.
61
+ #
62
+ # 5.4.5. http://dev.w3.org/csswg/css-syntax-3/#consume-a-declaration
63
+ #
64
+ # source://crass//lib/crass/parser.rb#209
19
65
  def consume_declaration(input = T.unsafe(nil)); end
66
+
67
+ # Consumes a list of declarations and returns them.
68
+ #
69
+ # By default, the returned list may include `:comment`, `:semicolon`, and
70
+ # `:whitespace` nodes, which is non-standard.
71
+ #
72
+ # Options:
73
+ #
74
+ # * **:strict** - Set to `true` to exclude non-standard `:comment`,
75
+ # `:semicolon`, and `:whitespace` nodes.
76
+ #
77
+ # 5.4.4. http://dev.w3.org/csswg/css-syntax/#consume-a-list-of-declarations
78
+ #
79
+ # source://crass//lib/crass/parser.rb#276
20
80
  def consume_declarations(input = T.unsafe(nil), options = T.unsafe(nil)); end
81
+
82
+ # Consumes a function and returns it.
83
+ #
84
+ # 5.4.8. http://dev.w3.org/csswg/css-syntax-3/#consume-a-function
85
+ #
86
+ # source://crass//lib/crass/parser.rb#326
21
87
  def consume_function(input = T.unsafe(nil)); end
88
+
89
+ # Consumes a qualified rule and returns it, or `nil` if a parse error
90
+ # occurs.
91
+ #
92
+ # 5.4.3. http://dev.w3.org/csswg/css-syntax-3/#consume-a-qualified-rule
93
+ #
94
+ # source://crass//lib/crass/parser.rb#357
22
95
  def consume_qualified_rule(input = T.unsafe(nil)); end
96
+
97
+ # Consumes a list of rules and returns them.
98
+ #
99
+ # 5.4.1. http://dev.w3.org/csswg/css-syntax/#consume-a-list-of-rules
100
+ #
101
+ # source://crass//lib/crass/parser.rb#398
23
102
  def consume_rules(flags = T.unsafe(nil)); end
103
+
104
+ # Consumes and returns a simple block associated with the current input
105
+ # token.
106
+ #
107
+ # 5.4.7. http://dev.w3.org/csswg/css-syntax/#consume-a-simple-block
108
+ #
109
+ # source://crass//lib/crass/parser.rb#434
24
110
  def consume_simple_block(input = T.unsafe(nil)); end
111
+
112
+ # Creates and returns a new parse node with the given _properties_.
113
+ #
114
+ # source://crass//lib/crass/parser.rb#458
25
115
  def create_node(type, properties = T.unsafe(nil)); end
116
+
117
+ # Parses the given _input_ tokens into a selector node and returns it.
118
+ #
119
+ # Doesn't bother splitting the selector list into individual selectors or
120
+ # validating them. Feel free to do that yourself! It'll be fun!
121
+ #
122
+ # source://crass//lib/crass/parser.rb#466
26
123
  def create_selector(input); end
124
+
125
+ # Creates a `:style_rule` node from the given qualified _rule_, and returns
126
+ # it.
127
+ #
128
+ # source://crass//lib/crass/parser.rb#474
27
129
  def create_style_rule(rule); end
130
+
131
+ # Parses a single component value and returns it.
132
+ #
133
+ # 5.3.7. http://dev.w3.org/csswg/css-syntax-3/#parse-a-component-value
134
+ #
135
+ # source://crass//lib/crass/parser.rb#483
28
136
  def parse_component_value(input = T.unsafe(nil)); end
137
+
138
+ # Parses a list of component values and returns an array of parsed tokens.
139
+ #
140
+ # 5.3.8. http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-component-values
141
+ #
142
+ # source://crass//lib/crass/parser.rb#510
29
143
  def parse_component_values(input = T.unsafe(nil)); end
144
+
145
+ # Parses a single declaration and returns it.
146
+ #
147
+ # 5.3.5. http://dev.w3.org/csswg/css-syntax/#parse-a-declaration
148
+ #
149
+ # source://crass//lib/crass/parser.rb#524
30
150
  def parse_declaration(input = T.unsafe(nil)); end
151
+
152
+ # Parses a list of declarations and returns them.
153
+ #
154
+ # See {#consume_declarations} for _options_.
155
+ #
156
+ # 5.3.6. http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-declarations
157
+ #
158
+ # source://crass//lib/crass/parser.rb#552
31
159
  def parse_declarations(input = T.unsafe(nil), options = T.unsafe(nil)); end
160
+
161
+ # Parses a list of declarations and returns an array of `:property` nodes
162
+ # (and any non-declaration nodes that were in the input). This is useful for
163
+ # parsing the contents of an HTML element's `style` attribute.
164
+ #
165
+ # source://crass//lib/crass/parser.rb#560
32
166
  def parse_properties(input = T.unsafe(nil)); end
167
+
168
+ # Parses a single rule and returns it.
169
+ #
170
+ # 5.3.4. http://dev.w3.org/csswg/css-syntax-3/#parse-a-rule
171
+ #
172
+ # source://crass//lib/crass/parser.rb#586
33
173
  def parse_rule(input = T.unsafe(nil)); end
174
+
175
+ # Returns the unescaped value of a selector name or property declaration.
176
+ #
177
+ # source://crass//lib/crass/parser.rb#615
34
178
  def parse_value(nodes); end
179
+
180
+ # {TokenScanner} wrapping the tokens generated from this parser's input.
181
+ #
182
+ # source://crass//lib/crass/parser.rb#120
35
183
  def tokens; end
36
184
 
37
185
  class << self
186
+ # Parses CSS properties (such as the contents of an HTML element's `style`
187
+ # attribute) and returns a parse tree.
188
+ #
189
+ # See {Tokenizer#initialize} for _options_.
190
+ #
191
+ # 5.3.6. http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-declarations
192
+ #
193
+ # source://crass//lib/crass/parser.rb#25
38
194
  def parse_properties(input, options = T.unsafe(nil)); end
195
+
196
+ # Parses CSS rules (such as the content of a `@media` block) and returns a
197
+ # parse tree. The only difference from {parse_stylesheet} is that CDO/CDC
198
+ # nodes (`<!--` and `-->`) aren't ignored.
199
+ #
200
+ # See {Tokenizer#initialize} for _options_.
201
+ #
202
+ # 5.3.3. http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-rules
203
+ #
204
+ # source://crass//lib/crass/parser.rb#36
39
205
  def parse_rules(input, options = T.unsafe(nil)); end
206
+
207
+ # Parses a CSS stylesheet and returns a parse tree.
208
+ #
209
+ # See {Tokenizer#initialize} for _options_.
210
+ #
211
+ # 5.3.2. http://dev.w3.org/csswg/css-syntax/#parse-a-stylesheet
212
+ #
213
+ # source://crass//lib/crass/parser.rb#54
40
214
  def parse_stylesheet(input, options = T.unsafe(nil)); end
215
+
216
+ # Converts a node or array of nodes into a CSS string based on their
217
+ # original tokenized input.
218
+ #
219
+ # Options:
220
+ #
221
+ # * **:exclude_comments** - When `true`, comments will be excluded.
222
+ #
223
+ # source://crass//lib/crass/parser.rb#74
41
224
  def stringify(nodes, options = T.unsafe(nil)); end
42
225
  end
43
226
  end
44
227
 
228
+ # source://crass//lib/crass/parser.rb#11
45
229
  Crass::Parser::BLOCK_END_TOKENS = T.let(T.unsafe(nil), Hash)
46
230
 
231
+ # Similar to a StringScanner, but with extra functionality needed to tokenize
232
+ # CSS while preserving the original text.
233
+ #
234
+ # source://crass//lib/crass/scanner.rb#8
47
235
  class Crass::Scanner
236
+ # Creates a Scanner instance for the given _input_ string or IO instance.
237
+ #
238
+ # @return [Scanner] a new instance of Scanner
239
+ #
240
+ # source://crass//lib/crass/scanner.rb#25
48
241
  def initialize(input); end
49
242
 
243
+ # Consumes the next character and returns it, advancing the pointer, or
244
+ # an empty string if the end of the string has been reached.
245
+ #
246
+ # source://crass//lib/crass/scanner.rb#34
50
247
  def consume; end
248
+
249
+ # Consumes the rest of the string and returns it, advancing the pointer to
250
+ # the end of the string. Returns an empty string is the end of the string
251
+ # has already been reached.
252
+ #
253
+ # source://crass//lib/crass/scanner.rb#46
51
254
  def consume_rest; end
255
+
256
+ # Current character, or `nil` if the scanner hasn't yet consumed a
257
+ # character, or is at the end of the string.
258
+ #
259
+ # source://crass//lib/crass/scanner.rb#11
52
260
  def current; end
261
+
262
+ # Returns `true` if the end of the string has been reached, `false`
263
+ # otherwise.
264
+ #
265
+ # @return [Boolean]
266
+ #
267
+ # source://crass//lib/crass/scanner.rb#57
53
268
  def eos?; end
269
+
270
+ # Sets the marker to the position of the next character that will be
271
+ # consumed.
272
+ #
273
+ # source://crass//lib/crass/scanner.rb#63
54
274
  def mark; end
275
+
276
+ # Returns the substring between {#marker} and {#pos}, without altering the
277
+ # pointer.
278
+ #
279
+ # source://crass//lib/crass/scanner.rb#69
55
280
  def marked; end
281
+
282
+ # Current marker position. Use {#marked} to get the substring between
283
+ # {#marker} and {#pos}.
284
+ #
285
+ # source://crass//lib/crass/scanner.rb#15
56
286
  def marker; end
57
- def marker=(_); end
287
+
288
+ # Current marker position. Use {#marked} to get the substring between
289
+ # {#marker} and {#pos}.
290
+ #
291
+ # source://crass//lib/crass/scanner.rb#15
292
+ def marker=(_arg0); end
293
+
294
+ # Returns up to _length_ characters starting at the current position, but
295
+ # doesn't consume them. The number of characters returned may be less than
296
+ # _length_ if the end of the string is reached.
297
+ #
298
+ # source://crass//lib/crass/scanner.rb#80
58
299
  def peek(length = T.unsafe(nil)); end
300
+
301
+ # Position of the next character that will be consumed. This is a character
302
+ # position, not a byte position, so it accounts for multi-byte characters.
303
+ #
304
+ # source://crass//lib/crass/scanner.rb#19
59
305
  def pos; end
60
- def pos=(_); end
306
+
307
+ # Position of the next character that will be consumed. This is a character
308
+ # position, not a byte position, so it accounts for multi-byte characters.
309
+ #
310
+ # source://crass//lib/crass/scanner.rb#19
311
+ def pos=(_arg0); end
312
+
313
+ # Moves the pointer back one character without changing the value of
314
+ # {#current}. The next call to {#consume} will re-consume the current
315
+ # character.
316
+ #
317
+ # source://crass//lib/crass/scanner.rb#87
61
318
  def reconsume; end
319
+
320
+ # Resets the pointer to the beginning of the string.
321
+ #
322
+ # source://crass//lib/crass/scanner.rb#93
62
323
  def reset; end
324
+
325
+ # Tries to match _pattern_ at the current position. If it matches, the
326
+ # matched substring will be returned and the pointer will be advanced.
327
+ # Otherwise, `nil` will be returned.
328
+ #
329
+ # source://crass//lib/crass/scanner.rb#103
63
330
  def scan(pattern); end
331
+
332
+ # Scans the string until the _pattern_ is matched. Returns the substring up
333
+ # to and including the end of the match, and advances the pointer. If there
334
+ # is no match, `nil` is returned and the pointer is not advanced.
335
+ #
336
+ # source://crass//lib/crass/scanner.rb#115
64
337
  def scan_until(pattern); end
338
+
339
+ # String being scanned.
340
+ #
341
+ # source://crass//lib/crass/scanner.rb#22
65
342
  def string; end
66
343
  end
67
344
 
345
+ # Like {Scanner}, but for tokens!
346
+ #
347
+ # source://crass//lib/crass/token-scanner.rb#6
68
348
  class Crass::TokenScanner
349
+ # @return [TokenScanner] a new instance of TokenScanner
350
+ #
351
+ # source://crass//lib/crass/token-scanner.rb#9
69
352
  def initialize(tokens); end
70
353
 
354
+ # Executes the given block, collects all tokens that are consumed during its
355
+ # execution, and returns them.
356
+ #
357
+ # source://crass//lib/crass/token-scanner.rb#16
71
358
  def collect; end
359
+
360
+ # Consumes the next token and returns it, advancing the pointer. Returns
361
+ # `nil` if there is no next token.
362
+ #
363
+ # source://crass//lib/crass/token-scanner.rb#24
72
364
  def consume; end
365
+
366
+ # Returns the value of attribute current.
367
+ #
368
+ # source://crass//lib/crass/token-scanner.rb#7
73
369
  def current; end
370
+
371
+ # Returns the next token without consuming it, or `nil` if there is no next
372
+ # token.
373
+ #
374
+ # source://crass//lib/crass/token-scanner.rb#32
74
375
  def peek; end
376
+
377
+ # Returns the value of attribute pos.
378
+ #
379
+ # source://crass//lib/crass/token-scanner.rb#7
75
380
  def pos; end
381
+
382
+ # Reconsumes the current token, moving the pointer back one position.
383
+ #
384
+ # http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/#reconsume-the-current-input-token
385
+ #
386
+ # source://crass//lib/crass/token-scanner.rb#39
76
387
  def reconsume; end
388
+
389
+ # Resets the pointer to the first token in the list.
390
+ #
391
+ # source://crass//lib/crass/token-scanner.rb#44
77
392
  def reset; end
393
+
394
+ # Returns the value of attribute tokens.
395
+ #
396
+ # source://crass//lib/crass/token-scanner.rb#7
78
397
  def tokens; end
79
398
  end
80
399
 
400
+ # Tokenizes a CSS string.
401
+ #
402
+ # 4. http://dev.w3.org/csswg/css-syntax/#tokenization
403
+ #
404
+ # source://crass//lib/crass/tokenizer.rb#9
81
405
  class Crass::Tokenizer
406
+ # Initializes a new Tokenizer.
407
+ #
408
+ # Options:
409
+ #
410
+ # * **:preserve_comments** - If `true`, comments will be preserved as
411
+ # `:comment` tokens.
412
+ #
413
+ # * **:preserve_hacks** - If `true`, certain non-standard browser hacks
414
+ # such as the IE "*" hack will be preserved even though they violate
415
+ # CSS 3 syntax rules.
416
+ #
417
+ # @return [Tokenizer] a new instance of Tokenizer
418
+ #
419
+ # source://crass//lib/crass/tokenizer.rb#62
82
420
  def initialize(input, options = T.unsafe(nil)); end
83
421
 
422
+ # Consumes a token and returns the token that was consumed.
423
+ #
424
+ # 4.3.1. http://dev.w3.org/csswg/css-syntax/#consume-a-token
425
+ #
426
+ # source://crass//lib/crass/tokenizer.rb#70
84
427
  def consume; end
428
+
429
+ # Consumes the remnants of a bad URL and returns the consumed text.
430
+ #
431
+ # 4.3.15. http://dev.w3.org/csswg/css-syntax/#consume-the-remnants-of-a-bad-url
432
+ #
433
+ # source://crass//lib/crass/tokenizer.rb#275
85
434
  def consume_bad_url; end
435
+
436
+ # Consumes comments and returns them, or `nil` if no comments were consumed.
437
+ #
438
+ # 4.3.2. http://dev.w3.org/csswg/css-syntax/#consume-comments
439
+ #
440
+ # source://crass//lib/crass/tokenizer.rb#301
86
441
  def consume_comments; end
442
+
443
+ # Consumes an escaped code point and returns its unescaped value.
444
+ #
445
+ # This method assumes that the `\` has already been consumed, and that the
446
+ # next character in the input has already been verified not to be a newline
447
+ # or EOF.
448
+ #
449
+ # 4.3.8. http://dev.w3.org/csswg/css-syntax/#consume-an-escaped-code-point
450
+ #
451
+ # source://crass//lib/crass/tokenizer.rb#326
87
452
  def consume_escaped; end
453
+
454
+ # Consumes an ident-like token and returns it.
455
+ #
456
+ # 4.3.4. http://dev.w3.org/csswg/css-syntax/#consume-an-ident-like-token
457
+ #
458
+ # source://crass//lib/crass/tokenizer.rb#350
88
459
  def consume_ident; end
460
+
461
+ # Consumes a name and returns it.
462
+ #
463
+ # 4.3.12. http://dev.w3.org/csswg/css-syntax/#consume-a-name
464
+ #
465
+ # source://crass//lib/crass/tokenizer.rb#375
89
466
  def consume_name; end
467
+
468
+ # Consumes a number and returns a 3-element array containing the number's
469
+ # original representation, its numeric value, and its type (either
470
+ # `:integer` or `:number`).
471
+ #
472
+ # 4.3.13. http://dev.w3.org/csswg/css-syntax/#consume-a-number
473
+ #
474
+ # source://crass//lib/crass/tokenizer.rb#407
90
475
  def consume_number; end
476
+
477
+ # Consumes a numeric token and returns it.
478
+ #
479
+ # 4.3.3. http://dev.w3.org/csswg/css-syntax/#consume-a-numeric-token
480
+ #
481
+ # source://crass//lib/crass/tokenizer.rb#430
91
482
  def consume_numeric; end
483
+
484
+ # Consumes a string token that ends at the given character, and returns the
485
+ # token.
486
+ #
487
+ # 4.3.5. http://dev.w3.org/csswg/css-syntax/#consume-a-string-token
488
+ #
489
+ # source://crass//lib/crass/tokenizer.rb#469
92
490
  def consume_string(ending = T.unsafe(nil)); end
491
+
492
+ # Consumes a Unicode range token and returns it. Assumes the initial "u+" or
493
+ # "U+" has already been consumed.
494
+ #
495
+ # 4.3.7. http://dev.w3.org/csswg/css-syntax/#consume-a-unicode-range-token
496
+ #
497
+ # source://crass//lib/crass/tokenizer.rb#510
93
498
  def consume_unicode_range; end
499
+
500
+ # Consumes a URL token and returns it. Assumes the original "url(" has
501
+ # already been consumed.
502
+ #
503
+ # 4.3.6. http://dev.w3.org/csswg/css-syntax/#consume-a-url-token
504
+ #
505
+ # source://crass//lib/crass/tokenizer.rb#542
94
506
  def consume_url; end
507
+
508
+ # Converts a valid CSS number string into a number and returns the number.
509
+ #
510
+ # 4.3.14. http://dev.w3.org/csswg/css-syntax/#convert-a-string-to-a-number
511
+ #
512
+ # source://crass//lib/crass/tokenizer.rb#590
95
513
  def convert_string_to_number(str); end
514
+
515
+ # Creates and returns a new token with the given _properties_.
516
+ #
517
+ # source://crass//lib/crass/tokenizer.rb#616
96
518
  def create_token(type, properties = T.unsafe(nil)); end
519
+
520
+ # Preprocesses _input_ to prepare it for the tokenizer.
521
+ #
522
+ # 3.3. http://dev.w3.org/csswg/css-syntax/#input-preprocessing
523
+ #
524
+ # source://crass//lib/crass/tokenizer.rb#627
97
525
  def preprocess(input); end
526
+
527
+ # Returns `true` if the given three-character _text_ would start an
528
+ # identifier. If _text_ is `nil`, the current and next two characters in the
529
+ # input stream will be checked, but will not be consumed.
530
+ #
531
+ # 4.3.10. http://dev.w3.org/csswg/css-syntax/#would-start-an-identifier
532
+ #
533
+ # @return [Boolean]
534
+ #
535
+ # source://crass//lib/crass/tokenizer.rb#642
98
536
  def start_identifier?(text = T.unsafe(nil)); end
537
+
538
+ # Returns `true` if the given three-character _text_ would start a number.
539
+ # If _text_ is `nil`, the current and next two characters in the input
540
+ # stream will be checked, but will not be consumed.
541
+ #
542
+ # 4.3.11. http://dev.w3.org/csswg/css-syntax/#starts-with-a-number
543
+ #
544
+ # @return [Boolean]
545
+ #
546
+ # source://crass//lib/crass/tokenizer.rb#666
99
547
  def start_number?(text = T.unsafe(nil)); end
548
+
549
+ # Tokenizes the input stream and returns an array of tokens.
550
+ #
551
+ # source://crass//lib/crass/tokenizer.rb#685
100
552
  def tokenize; end
553
+
554
+ # Returns `true` if the given two-character _text_ is the beginning of a
555
+ # valid escape sequence. If _text_ is `nil`, the current and next character
556
+ # in the input stream will be checked, but will not be consumed.
557
+ #
558
+ # 4.3.9. http://dev.w3.org/csswg/css-syntax/#starts-with-a-valid-escape
559
+ #
560
+ # @return [Boolean]
561
+ #
562
+ # source://crass//lib/crass/tokenizer.rb#702
101
563
  def valid_escape?(text = T.unsafe(nil)); end
102
564
 
103
565
  class << self
566
+ # Tokenizes the given _input_ as a CSS string and returns an array of
567
+ # tokens.
568
+ #
569
+ # See {#initialize} for _options_.
570
+ #
571
+ # source://crass//lib/crass/tokenizer.rb#45
104
572
  def tokenize(input, options = T.unsafe(nil)); end
105
573
  end
106
574
  end
107
575
 
576
+ # source://crass//lib/crass/tokenizer.rb#10
108
577
  Crass::Tokenizer::RE_COMMENT_CLOSE = T.let(T.unsafe(nil), Regexp)
109
578
 
579
+ # source://crass//lib/crass/tokenizer.rb#11
110
580
  Crass::Tokenizer::RE_DIGIT = T.let(T.unsafe(nil), Regexp)
111
581
 
582
+ # source://crass//lib/crass/tokenizer.rb#12
112
583
  Crass::Tokenizer::RE_ESCAPE = T.let(T.unsafe(nil), Regexp)
113
584
 
585
+ # source://crass//lib/crass/tokenizer.rb#13
114
586
  Crass::Tokenizer::RE_HEX = T.let(T.unsafe(nil), Regexp)
115
587
 
588
+ # source://crass//lib/crass/tokenizer.rb#14
116
589
  Crass::Tokenizer::RE_NAME = T.let(T.unsafe(nil), Regexp)
117
590
 
591
+ # source://crass//lib/crass/tokenizer.rb#15
118
592
  Crass::Tokenizer::RE_NAME_START = T.let(T.unsafe(nil), Regexp)
119
593
 
594
+ # source://crass//lib/crass/tokenizer.rb#16
120
595
  Crass::Tokenizer::RE_NON_PRINTABLE = T.let(T.unsafe(nil), Regexp)
121
596
 
597
+ # source://crass//lib/crass/tokenizer.rb#17
122
598
  Crass::Tokenizer::RE_NUMBER_DECIMAL = T.let(T.unsafe(nil), Regexp)
123
599
 
600
+ # source://crass//lib/crass/tokenizer.rb#18
124
601
  Crass::Tokenizer::RE_NUMBER_EXPONENT = T.let(T.unsafe(nil), Regexp)
125
602
 
603
+ # source://crass//lib/crass/tokenizer.rb#19
126
604
  Crass::Tokenizer::RE_NUMBER_SIGN = T.let(T.unsafe(nil), Regexp)
127
605
 
606
+ # source://crass//lib/crass/tokenizer.rb#21
128
607
  Crass::Tokenizer::RE_NUMBER_STR = T.let(T.unsafe(nil), Regexp)
129
608
 
609
+ # source://crass//lib/crass/tokenizer.rb#33
130
610
  Crass::Tokenizer::RE_QUOTED_URL_START = T.let(T.unsafe(nil), Regexp)
131
611
 
612
+ # source://crass//lib/crass/tokenizer.rb#35
132
613
  Crass::Tokenizer::RE_UNICODE_RANGE_END = T.let(T.unsafe(nil), Regexp)
133
614
 
615
+ # source://crass//lib/crass/tokenizer.rb#34
134
616
  Crass::Tokenizer::RE_UNICODE_RANGE_START = T.let(T.unsafe(nil), Regexp)
135
617
 
618
+ # source://crass//lib/crass/tokenizer.rb#36
136
619
  Crass::Tokenizer::RE_WHITESPACE = T.let(T.unsafe(nil), Regexp)
137
620
 
621
+ # source://crass//lib/crass/tokenizer.rb#37
138
622
  Crass::Tokenizer::RE_WHITESPACE_ANCHORED = T.let(T.unsafe(nil), Regexp)