Module: DrgDSL
- Defined in:
- lib/drgdsl.rb,
lib/drgdsl/ast.rb,
lib/drgdsl/parser.rb,
lib/drgdsl/version.rb,
lib/drgdsl/visitor.rb,
lib/drgdsl/ast_builder.rb,
lib/drgdsl/paren_cleaner.rb,
lib/drgdsl/pretty_printer.rb,
lib/drgdsl/core_extensions.rb
Defined Under Namespace
Modules: Ast, CoreExtensions, Visitor Classes: AstBuilder, ParenCleaner, Parser, ParserError, PrettyPrinter, UnknownCstError
Constant Summary collapse
- VERSION =
"1.2.0"
Class Method Summary collapse
-
.json(input) ⇒ String
JSON representation of the AST.
- .parse(input) ⇒ Ast::Node
-
.pretty_print(input, **options) ⇒ String
Pretty printed DrgDSL expression.
Class Method Details
.json(input) ⇒ String
Returns JSON representation of the AST.
24 25 26 |
# File 'lib/drgdsl.rb', line 24 def self.json(input) Oj.dump parse(input).to_hash, mode: :compat end |
.parse(input) ⇒ Ast::Node
18 19 20 |
# File 'lib/drgdsl.rb', line 18 def self.parse(input) Parser.parse(input) end |
.pretty_print(input, **options) ⇒ String
Returns pretty printed DrgDSL expression.
74 75 76 |
# File 'lib/drgdsl.rb', line 74 def self.pretty_print(input, **) PrettyPrinter.pretty_print(input, **) end |