Module: SyntaxTree::Bf

Defined in:
lib/syntax_tree/bf.rb,
lib/syntax_tree/bf/nodes.rb,
lib/syntax_tree/bf/format.rb,
lib/syntax_tree/bf/parser.rb,
lib/syntax_tree/bf/version.rb,
lib/syntax_tree/bf/visitor.rb,
lib/syntax_tree/bf/evaluate.rb,
lib/syntax_tree/bf/pretty_print.rb

Defined Under Namespace

Modules: Evaluate Classes: Decrement, Format, Increment, Input, Loop, Node, Output, Parser, PrettyPrint, Root, ShiftLeft, ShiftRight, Visitor

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.format(source, maxwidth = 80) ⇒ Object



16
17
18
# File 'lib/syntax_tree/bf.rb', line 16

def self.format(source, maxwidth = 80)
  PrettierPrint.format(+"", maxwidth) { |q| parse(source).format(q) }
end

.parse(source) ⇒ Object



20
21
22
# File 'lib/syntax_tree/bf.rb', line 20

def self.parse(source)
  Parser.new(source).parse
end

.read(source) ⇒ Object



24
25
26
# File 'lib/syntax_tree/bf.rb', line 24

def self.read(source)
  File.read(source)
end