lib/nql/grammar.rb in nql-0.1.1 vs lib/nql/grammar.rb in nql-0.1.2
- old
+ new
@@ -143,21 +143,36 @@
module Primary1
def space1
elements[1]
end
- def expression
+ def comparison
elements[2]
end
def space2
elements[3]
end
end
module Primary2
+ def space1
+ elements[1]
+ end
+
+ def expression
+ elements[2]
+ end
+
+ def space2
+ elements[3]
+ end
+
+ end
+
+ module Primary3
def to_ransack
detect_node.to_ransack
end
def detect_node
@@ -199,11 +214,11 @@
@index = i1
r1 = nil
end
if r1
r0 = r1
- r0.extend(Primary2)
+ r0.extend(Primary3)
else
i5, s5 = index, []
if has_terminal?('(', false, index)
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
@@ -214,11 +229,11 @@
s5 << r6
if r6
r7 = _nt_space
s5 << r7
if r7
- r8 = _nt_expression
+ r8 = _nt_comparison
s5 << r8
if r8
r9 = _nt_space
s5 << r9
if r9
@@ -241,13 +256,56 @@
@index = i5
r5 = nil
end
if r5
r0 = r5
- r0.extend(Primary2)
+ r0.extend(Primary3)
else
- @index = i0
- r0 = nil
+ i11, s11 = index, []
+ if has_terminal?('(', false, index)
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure('(')
+ r12 = nil
+ end
+ s11 << r12
+ if r12
+ r13 = _nt_space
+ s11 << r13
+ if r13
+ r14 = _nt_expression
+ s11 << r14
+ if r14
+ r15 = _nt_space
+ s11 << r15
+ if r15
+ if has_terminal?(')', false, index)
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
+ @index += 1
+ else
+ terminal_parse_failure(')')
+ r16 = nil
+ end
+ s11 << r16
+ end
+ end
+ end
+ end
+ if s11.last
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
+ r11.extend(Primary2)
+ else
+ @index = i11
+ r11 = nil
+ end
+ if r11
+ r0 = r11
+ r0.extend(Primary3)
+ else
+ @index = i0
+ r0 = nil
+ end
end
end
node_cache[:primary][start_index] = r0
\ No newline at end of file