Class: MilkTea::CSTBuilder
- Inherits:
-
Object
- Object
- MilkTea::CSTBuilder
- Defined in:
- lib/milk_tea/core/cst_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(source, path: nil) ⇒ CSTBuilder
constructor
A new instance of CSTBuilder.
Constructor Details
#initialize(source, path: nil) ⇒ CSTBuilder
Returns a new instance of CSTBuilder.
9 10 11 12 |
# File 'lib/milk_tea/core/cst_builder.rb', line 9 def initialize(source, path: nil) @source = source @path = path end |
Class Method Details
.build(source, path: nil) ⇒ Object
5 6 7 |
# File 'lib/milk_tea/core/cst_builder.rb', line 5 def self.build(source, path: nil) new(source, path:).build end |
Instance Method Details
#build ⇒ Object
14 15 16 17 |
# File 'lib/milk_tea/core/cst_builder.rb', line 14 def build lexed = Lexer.lex_with_trivia(@source, path: @path) CST::SourceFile.new(source: @source, tokens: lexed.tokens, trivia: lexed.trivia) end |