Class: Kumi::Parser::SyntaxValidator
- Inherits:
-
Object
- Object
- Kumi::Parser::SyntaxValidator
- Defined in:
- lib/kumi/parser/syntax_validator.rb
Overview
Validates Kumi DSL syntax using new parser
Instance Method Summary collapse
- #first_error(text, source_file: '<input>') ⇒ Object
- #valid?(text, source_file: '<input>') ⇒ Boolean
- #validate(text, source_file: '<input>') ⇒ Object
Instance Method Details
#first_error(text, source_file: '<input>') ⇒ Object
15 16 17 18 |
# File 'lib/kumi/parser/syntax_validator.rb', line 15 def first_error(text, source_file: '<input>') diagnostics = validate(text, source_file: source_file) diagnostics.empty? ? nil : diagnostics.first[:message] end |
#valid?(text, source_file: '<input>') ⇒ Boolean
11 12 13 |
# File 'lib/kumi/parser/syntax_validator.rb', line 11 def valid?(text, source_file: '<input>') validate(text, source_file: source_file).empty? end |