Class: Code::Parser

Inherits:
Object show all
Defined in:
lib/code/parser.rb,
lib/code/parser/if.rb,
lib/code/parser/call.rb,
lib/code/parser/code.rb,
lib/code/parser/list.rb,
lib/code/parser/name.rb,
lib/code/parser/class.rb,
lib/code/parser/equal.rb,
lib/code/parser/group.rb,
lib/code/parser/power.rb,
lib/code/parser/range.rb,
lib/code/parser/shift.rb,
lib/code/parser/splat.rb,
lib/code/parser/while.rb,
lib/code/parser/number.rb,
lib/code/parser/rescue.rb,
lib/code/parser/string.rb,
lib/code/parser/boolean.rb,
lib/code/parser/greater.rb,
lib/code/parser/nothing.rb,
lib/code/parser/ternary.rb,
lib/code/parser/addition.rb,
lib/code/parser/equality.rb,
lib/code/parser/function.rb,
lib/code/parser/negation.rb,
lib/code/parser/statement.rb,
lib/code/parser/bitwise_or.rb,
lib/code/parser/dictionary.rb,
lib/code/parser/or_keyword.rb,
lib/code/parser/whitespace.rb,
lib/code/parser/bitwise_and.rb,
lib/code/parser/if_modifier.rb,
lib/code/parser/not_keyword.rb,
lib/code/parser/or_operator.rb,
lib/code/parser/unary_minus.rb,
lib/code/parser/and_operator.rb,
lib/code/parser/chained_call.rb,
lib/code/parser/left_operation.rb,
lib/code/parser/multiplication.rb,
lib/code/parser/square_bracket.rb,
lib/code/parser/right_operation.rb

Defined Under Namespace

Classes: Addition, AndOperator, BitwiseAnd, BitwiseOr, Boolean, Call, ChainedCall, Class, Code, Dictionary, Equal, Equality, Error, Function, Greater, Group, If, IfModifier, LeftOperation, List, Multiplication, Name, Negation, NotKeyword, Nothing, Number, OrKeyword, OrOperator, Power, Range, Rescue, RightOperation, Shift, Splat, SquareBracket, Statement, String, Ternary, UnaryMinus, While, Whitespace

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Parser

Returns a new instance of Parser.



8
9
10
# File 'lib/code/parser.rb', line 8

def initialize(input)
  @input = input
end

Class Method Details

.parseObject



12
13
14
# File 'lib/code/parser.rb', line 12

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

Instance Method Details

#parseObject



16
17
18
19
20
# File 'lib/code/parser.rb', line 16

def parse
  Code.parse(input)
rescue Language::Parser::NotEndOfInput => e
  raise Error, e.message
end