Module: Kumi::TextParser
Overview
Top-level text parser module with same interface as Ruby DSL
Instance Method Summary collapse
-
#diagnostics_as_json(text, source_file: '<input>') ⇒ Object
Get JSON format diagnostics.
-
#diagnostics_for_codemirror(text, source_file: '<input>') ⇒ Object
Get CodeMirror format diagnostics.
-
#diagnostics_for_monaco(text, source_file: '<input>') ⇒ Object
Get Monaco Editor format diagnostics.
-
#parse(text, source_file: '<input>') ⇒ Object
Parse text schema and return AST (same interface as RubyParser::Dsl.build_syntax_tree).
-
#valid?(text, source_file: '<input>') ⇒ Boolean
Validate text schema.
-
#validate(text, source_file: '<input>') ⇒ Object
Get validation diagnostics.
Instance Method Details
#diagnostics_as_json(text, source_file: '<input>') ⇒ Object
Get JSON format diagnostics
36 37 38 |
# File 'lib/kumi/text_parser.rb', line 36 def diagnostics_as_json(text, source_file: '<input>') Parser::TextParser.diagnostics_as_json(text, source_file: source_file) end |
#diagnostics_for_codemirror(text, source_file: '<input>') ⇒ Object
Get CodeMirror format diagnostics
31 32 33 |
# File 'lib/kumi/text_parser.rb', line 31 def diagnostics_for_codemirror(text, source_file: '<input>') Parser::TextParser.diagnostics_for_codemirror(text, source_file: source_file) end |
#diagnostics_for_monaco(text, source_file: '<input>') ⇒ Object
Get Monaco Editor format diagnostics
26 27 28 |
# File 'lib/kumi/text_parser.rb', line 26 def diagnostics_for_monaco(text, source_file: '<input>') Parser::TextParser.diagnostics_for_monaco(text, source_file: source_file) end |
#parse(text, source_file: '<input>') ⇒ Object
Parse text schema and return AST (same interface as RubyParser::Dsl.build_syntax_tree)
11 12 13 |
# File 'lib/kumi/text_parser.rb', line 11 def parse(text, source_file: '<input>') Parser::TextParser.parse(text, source_file: source_file) end |
#valid?(text, source_file: '<input>') ⇒ Boolean
Validate text schema
16 17 18 |
# File 'lib/kumi/text_parser.rb', line 16 def valid?(text, source_file: '<input>') Parser::TextParser.valid?(text, source_file: source_file) end |
#validate(text, source_file: '<input>') ⇒ Object
Get validation diagnostics
21 22 23 |
# File 'lib/kumi/text_parser.rb', line 21 def validate(text, source_file: '<input>') Parser::TextParser.validate(text, source_file: source_file) end |