Module: Oppen
- Defined in:
- lib/oppen.rb,
lib/oppen/token.rb,
lib/oppen/utils.rb,
lib/wadler/print.rb,
lib/oppen/printer.rb,
lib/oppen/version.rb,
lib/oppen/scan_stack.rb,
lib/oppen/print_stack.rb
Overview
Oppen.
Defined Under Namespace
Modules: Utils Classes: Config, PrintStack, Printer, ScanStack, Token, Wadler
Constant Summary collapse
- VERSION =
Oppen version
'0.9.1'
Class Method Summary collapse
-
.begin_consistent(offset: 2) ⇒ Oppen::Token::Begin
A new consistent Begin token.
-
.begin_inconsistent(offset: 2) ⇒ Oppen::Token::Begin
A new inconsistent Begin token.
-
.break(str = ' ', line_continuation: '', offset: 0, width: str.length) ⇒ Oppen::Token::Break
A new Break token.
-
.end ⇒ Oppen::Token::End
A new End token.
-
.eof ⇒ Oppen::Token::EOF
A new EOF token.
-
.line_break(line_continuation: '', offset: 0) ⇒ Oppen::Token::LineBreak
A new LineBreak token.
-
.print(config: Config.oppen, space: ' ', new_line: "\n", out: StringIO.new, tokens: [], width: 80) ⇒ String
Entry point of the pretty printer.
-
.string(value, width: value.length) ⇒ Oppen::Token::String
A new String token.
Class Method Details
.begin_consistent(offset: 2) ⇒ Oppen::Token::Begin
Returns a new consistent Begin token.
132 133 134 |
# File 'lib/oppen.rb', line 132 def self.begin_consistent(offset: 2) Token::Begin.new(break_type: Token::BreakType::CONSISTENT, offset:) end |
.begin_inconsistent(offset: 2) ⇒ Oppen::Token::Begin
Returns a new inconsistent Begin token.
139 140 141 |
# File 'lib/oppen.rb', line 139 def self.begin_inconsistent(offset: 2) Token::Begin.new(break_type: Token::BreakType::INCONSISTENT, offset:) end |
.break(str = ' ', line_continuation: '', offset: 0, width: str.length) ⇒ Oppen::Token::Break
Returns a new Break token.
117 118 119 |
# File 'lib/oppen.rb', line 117 def self.break(str = ' ', line_continuation: '', offset: 0, width: str.length) Token::Break.new(str, width:, line_continuation:, offset:) end |
.end ⇒ Oppen::Token::End
Returns a new End token.
144 145 146 |
# File 'lib/oppen.rb', line 144 def self.end Token::End.new end |
.eof ⇒ Oppen::Token::EOF
Returns a new EOF token.
149 150 151 |
# File 'lib/oppen.rb', line 149 def self.eof Token::EOF.new end |
.line_break(line_continuation: '', offset: 0) ⇒ Oppen::Token::LineBreak
Returns a new LineBreak token.
125 126 127 |
# File 'lib/oppen.rb', line 125 def self.line_break(line_continuation: '', offset: 0) Token::LineBreak.new(line_continuation:, offset:) end |
.print(config: Config.oppen, space: ' ', new_line: "\n", out: StringIO.new, tokens: [], width: 80) ⇒ String
Entry point of the pretty printer.
27 28 29 30 31 32 33 34 |
# File 'lib/oppen.rb', line 27 def self.print(config: Config.oppen, space: ' ', new_line: "\n", out: StringIO.new, tokens: [], width: 80) printer = Printer.new width, new_line, config, space, out tokens.each do |token| printer.print token end printer.output end |
.string(value, width: value.length) ⇒ Oppen::Token::String
Returns a new String token.
107 108 109 |
# File 'lib/oppen.rb', line 107 def self.string(value, width: value.length) Token::String.new(value, width:) end |