Class: Scim2::Filter::Parser

Inherits:
Racc::Parser
  • Object
show all
Defined in:
lib/scim2/filter/parser.rb,
lib/scim2/filter/parser.tab.rb

Overview

Implements a SCIM2 compliant event-based parser for query filters. The parser will emit four different events to a handler implemention as it encounters various components within the filter. For reference, see:

Constant Summary collapse

Racc_arg =
[
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table =
[
"$end",
"error",
"EQ",
"NE",
"GT",
"GE",
"LT",
"LE",
"CO",
"SW",
"EW",
"PR",
"AND",
"OR",
"NOT",
"LPAREN",
"RPAREN",
"LBRACKET",
"RBRACKET",
"NULL",
"BOOLEAN",
"NUMBER",
"STRING",
"ATTRNAME",
"SCHEMA",
"DOT",
"$start",
"filter",
"non_or_filter",
"non_boolean_filter",
"attribute_filter",
"nested_filter",
"grouped_filter",
"not_filter",
"attr_path",
"comp_op",
"comp_value",
"attr_path_elements" ]
Racc_debug_parser =
false

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler = SimpleHandler.new) ⇒ Parser



20
21
22
23
# File 'lib/scim2/filter/parser.rb', line 20

def initialize(handler = SimpleHandler.new)
  super()
  @handler = handler
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



17
18
19
# File 'lib/scim2/filter/parser.rb', line 17

def handler
  @handler
end

Instance Method Details

#_reduce_none(val, _values, result) ⇒ Object

reduce 30 omitted



321
322
323
# File 'lib/scim2/filter/parser.tab.rb', line 321

def _reduce_none(val, _values, result)
  val[0]
end

#next_tokenString

Required by Racc::Parser to emit the next token to the parser. This method should generally not be called directly.



28
29
30
# File 'lib/scim2/filter/parser.rb', line 28

def next_token
  @lexer.next_token
end

#parse(string) ⇒ Object

Parses a given string input



35
36
37
38
39
# File 'lib/scim2/filter/parser.rb', line 35

def parse(string)
  @lexer = Lexer.new
  @lexer.scan_setup(string)
  do_parse
end