Class: FlatIncludes
- Inherits:
-
GrammarLinter
- Object
- GrammarPlugin
- GrammarLinter
- FlatIncludes
- Defined in:
- lib/ruby_grammar_builder/linters/flat_includes.rb
Overview
Internal check, ensures that :includes is nil or a flat array
Instance Method Summary collapse
-
#pre_lint(pattern, options) ⇒ Boolean
Runs the linter on each pattern.
Methods inherited from GrammarLinter
Methods inherited from GrammarPlugin
Instance Method Details
#pre_lint(pattern, options) ⇒ Boolean
Runs the linter on each pattern
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_grammar_builder/linters/flat_includes.rb', line 12 def pre_lint(pattern, ) return true unless pattern.is_a? PatternBase return true if pattern.arguments[:includes].nil? if pattern.arguments[:includes].is_a?(Array) && pattern.arguments[:includes].none? { |v| v.is_a? Array } flat = true pattern.arguments[:includes].map do |s| flat = false unless pre_lint(s, ) end return flat end puts "The pattern `#{pattern.name}' does not have a flat includes array." puts "This is an internal error" false end |