Class: Deadfire::ParserEngine
- Inherits:
-
Object
- Object
- Deadfire::ParserEngine
- Defined in:
- lib/deadfire/parser_engine.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#error_reporter ⇒ Object
readonly
Returns the value of attribute error_reporter.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #errors? ⇒ Boolean
-
#initialize(content, options = {}) ⇒ ParserEngine
constructor
A new instance of ParserEngine.
- #load_mixins ⇒ Object
- #parse ⇒ Object
- #print_ast ⇒ Object
Constructor Details
#initialize(content, options = {}) ⇒ ParserEngine
Returns a new instance of ParserEngine.
7 8 9 10 11 12 |
# File 'lib/deadfire/parser_engine.rb', line 7 def initialize(content, = {}) @error_reporter = ErrorReporter.new @options = {} @asset_loader = AssetLoader.new([:filename]) @scanner = FrontEnd::Scanner.new(content, error_reporter) end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
5 6 7 |
# File 'lib/deadfire/parser_engine.rb', line 5 def current @current end |
#error_reporter ⇒ Object (readonly)
Returns the value of attribute error_reporter.
5 6 7 |
# File 'lib/deadfire/parser_engine.rb', line 5 def error_reporter @error_reporter end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/deadfire/parser_engine.rb', line 5 def @options end |
Instance Method Details
#errors? ⇒ Boolean
31 32 33 |
# File 'lib/deadfire/parser_engine.rb', line 31 def errors? @error_reporter.errors? end |
#load_mixins ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/deadfire/parser_engine.rb', line 35 def load_mixins ast = _parse parser = MixinParser.new ast.statements.each do |node| parser.interpret(node) end parser.mixins end |
#parse ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/deadfire/parser_engine.rb', line 14 def parse ast = _parse interpreter = Interpreter.new(error_reporter, @asset_loader) ast.statements.each do |node| interpreter.interpret(node) end CssGenerator.new(ast).generate end |
#print_ast ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/deadfire/parser_engine.rb', line 23 def print_ast ast = _parse printer = AstPrinter.new ast.statements.each do |node| printer.print(node) end end |