mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
885 lines
26 KiB
Text
885 lines
26 KiB
Text
#
|
|
# DO NOT MODIFY!!!!
|
|
# This file is automatically generated by Racc 1.4.14
|
|
# from Racc grammer file "".
|
|
#
|
|
|
|
require 'racc/parser.rb'
|
|
module Liquor
|
|
class Parser < Racc::Parser
|
|
|
|
module_eval(<<'...end liquor.y/module_eval...', 'liquor.y', 216)
|
|
attr_reader :errors, :ast
|
|
|
|
def initialize(tags={})
|
|
super()
|
|
|
|
@errors = []
|
|
@ast = nil
|
|
@tags = tags
|
|
end
|
|
|
|
def success?
|
|
@errors.empty?
|
|
end
|
|
|
|
def parse(string, name='(code)')
|
|
@errors.clear
|
|
@name = name
|
|
@ast = nil
|
|
|
|
begin
|
|
@stream = Lexer.lex(string, @name, @tags)
|
|
@ast = do_parse
|
|
rescue Liquor::SyntaxError => e
|
|
@errors << e
|
|
end
|
|
|
|
success?
|
|
end
|
|
|
|
def next_token
|
|
tok = @stream.shift
|
|
[ tok[0], tok ] if tok
|
|
end
|
|
|
|
TOKEN_NAME_MAP = {
|
|
:comma => ',',
|
|
:dot => '.',
|
|
:lblock => '{%',
|
|
:rblock => '%}',
|
|
:linterp => '{{',
|
|
:rinterp => '}}',
|
|
:lbracket => '[',
|
|
:rbracket => ']',
|
|
:lparen => '(',
|
|
:rparen => ')',
|
|
:pipe => '|',
|
|
:op_not => '!',
|
|
:op_mul => '*',
|
|
:op_div => '/',
|
|
:op_mod => '%',
|
|
:op_plus => '+',
|
|
:op_minus => '-',
|
|
:op_eq => '==',
|
|
:op_neq => '!=',
|
|
:op_lt => '<',
|
|
:op_leq => '<=',
|
|
:op_gt => '>',
|
|
:op_geq => '>=',
|
|
:keyword => 'keyword argument name',
|
|
:kwarg => 'keyword argument',
|
|
:ident => 'identifier',
|
|
}
|
|
|
|
def on_error(error_token_id, error_token, value_stack)
|
|
if token_to_str(error_token_id) == "$end"
|
|
raise Liquor::SyntaxError.new("unexpected end of program", {
|
|
file: @name
|
|
})
|
|
else
|
|
type, (loc, value) = error_token
|
|
type = TOKEN_NAME_MAP[type] || type
|
|
|
|
raise Liquor::SyntaxError.new("unexpected token `#{type}'", loc)
|
|
end
|
|
end
|
|
|
|
def retag(nodes)
|
|
loc = nodes.map { |node| node[1] }.compact
|
|
first, *, last = loc
|
|
return first if last.nil?
|
|
|
|
{
|
|
file: first[:file],
|
|
line: first[:line],
|
|
start: first[:start],
|
|
end: last[:end],
|
|
}
|
|
end
|
|
|
|
def reduce_tag_args(list)
|
|
list.each_slice(2).reduce([]) { |args, (k, v)|
|
|
if v[0] == :block
|
|
args << [ :blockarg, retag([ k, v ]), k, v[2] || [] ]
|
|
else
|
|
args << [ :kwarg, retag([ k, v ]), k, v ]
|
|
end
|
|
}
|
|
end
|
|
...end liquor.y/module_eval...
|
|
##### State transition tables begin ###
|
|
|
|
racc_action_table = [
|
|
76, 26, 26, 6, 77, 70, 5, 6, 25, 25,
|
|
5, 28, 32, 36, 37, 34, 35, 31, 29, 27,
|
|
33, 2, 30, 26, 26, 2, 6, 43, 52, 5,
|
|
25, 25, 38, 39, 28, 32, 36, 37, 34, 35,
|
|
31, 29, 27, 33, 2, 30, 26, 94, 51, 98,
|
|
26, 96, 26, 25, 97, 38, 39, 25, 111, 25,
|
|
28, 32, 36, 37, 34, 35, 31, 29, 27, 33,
|
|
41, 30, 26, 26, 43, 6, 107, 74, 5, 25,
|
|
25, 38, 39, 28, 32, 36, 37, 34, 35, 31,
|
|
29, 27, 33, 2, 30, 7, 26, 70, 6, 96,
|
|
102, 5, 97, 25, 38, 39, 28, 32, 36, 37,
|
|
34, 35, 31, 29, 27, 33, 2, 30, 54, 26,
|
|
74, 6, 96, 74, 5, 97, 25, 38, 39, 28,
|
|
32, 36, 37, 34, 35, 31, 29, 27, 33, 2,
|
|
30, 87, 26, 96, 6, 22, 97, 5, 84, 25,
|
|
38, 39, 28, 32, 36, 37, 34, 35, 31, 29,
|
|
27, 33, 2, 30, 40, 26, 23, nil, 24, nil,
|
|
nil, nil, 25, 38, 39, 28, 32, 36, 37, 34,
|
|
35, 31, 29, 27, 33, nil, 30, nil, 26, nil,
|
|
82, nil, 52, nil, nil, 25, 38, 39, 28, 32,
|
|
36, 37, 34, 35, 31, 29, 27, 33, nil, 30,
|
|
nil, 26, 51, nil, nil, nil, nil, nil, 25, 38,
|
|
39, 28, 32, 36, 37, 34, 35, 31, 29, 27,
|
|
33, nil, 30, nil, 26, nil, nil, nil, 75, nil,
|
|
nil, 25, 38, 39, 28, 32, 36, 37, 34, 35,
|
|
31, 29, 27, 33, nil, 30, 13, 15, nil, 13,
|
|
15, 21, nil, 14, 21, 38, 14, nil, nil, nil,
|
|
18, nil, nil, 18, 19, nil, nil, 19, nil, 13,
|
|
15, nil, 16, nil, 21, 16, 14, nil, nil, 13,
|
|
15, nil, nil, 18, 21, nil, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, 74, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, 52, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, 51, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, 81, nil, 18, 21, 16, 14, 19, nil, 13,
|
|
15, nil, 26, 18, 21, 16, 14, 19, nil, 25,
|
|
nil, 101, 28, 18, nil, 16, 26, 19, nil, 29,
|
|
27, 106, nil, 25, nil, 16, 28, 32, 36, 37,
|
|
34, 35, 31, 29, 27, 33, 26, 30, nil, nil,
|
|
nil, nil, nil, 25, nil, nil, 28, nil, 26, nil,
|
|
nil, nil, 31, 29, 27, 25, nil, 30, 28, nil,
|
|
26, nil, nil, nil, 31, 29, 27, 25, nil, 30,
|
|
28, nil, 26, nil, nil, nil, 31, 29, 27, 25,
|
|
nil, 30, 28, nil, 26, nil, nil, nil, 31, 29,
|
|
27, 25, nil, 30, 28, nil, 26, nil, nil, nil,
|
|
31, 29, 27, 25, nil, 30, 28, nil, 26, nil,
|
|
nil, nil, 31, 29, 27, 25, nil, 30, 28, nil,
|
|
nil, nil, nil, nil, nil, 29, 27 ]
|
|
|
|
racc_action_check = [
|
|
47, 47, 55, 101, 48, 84, 101, 4, 47, 55,
|
|
4, 47, 47, 47, 47, 47, 47, 47, 47, 47,
|
|
47, 101, 47, 56, 79, 4, 0, 54, 79, 0,
|
|
56, 79, 47, 47, 79, 79, 79, 79, 79, 79,
|
|
79, 79, 79, 79, 0, 79, 57, 91, 79, 96,
|
|
104, 104, 45, 57, 104, 79, 79, 104, 109, 45,
|
|
104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
|
|
12, 104, 46, 71, 13, 2, 103, 71, 2, 46,
|
|
71, 104, 104, 71, 71, 71, 71, 71, 71, 71,
|
|
71, 71, 71, 2, 71, 1, 99, 40, 3, 107,
|
|
99, 3, 107, 99, 71, 71, 99, 99, 99, 99,
|
|
99, 99, 99, 99, 99, 99, 3, 99, 26, 88,
|
|
70, 81, 94, 88, 81, 94, 88, 99, 99, 88,
|
|
88, 88, 88, 88, 88, 88, 88, 88, 88, 81,
|
|
88, 72, 11, 111, 106, 6, 111, 106, 69, 11,
|
|
88, 88, 11, 11, 11, 11, 11, 11, 11, 11,
|
|
11, 11, 106, 11, 11, 53, 7, nil, 11, nil,
|
|
nil, nil, 53, 11, 11, 53, 53, 53, 53, 53,
|
|
53, 53, 53, 53, 53, nil, 53, nil, 49, nil,
|
|
53, nil, 49, nil, nil, 49, 53, 53, 49, 49,
|
|
49, 49, 49, 49, 49, 49, 49, 49, nil, 49,
|
|
nil, 44, 49, nil, nil, nil, nil, nil, 44, 49,
|
|
49, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
|
44, nil, 44, nil, 67, nil, nil, nil, 44, nil,
|
|
nil, 67, 44, 44, 67, 67, 67, 67, 67, 67,
|
|
67, 67, 67, 67, nil, 67, 30, 30, nil, 31,
|
|
31, 30, nil, 30, 31, 67, 31, nil, nil, nil,
|
|
30, nil, nil, 31, 30, nil, nil, 31, nil, 32,
|
|
32, nil, 30, nil, 32, 31, 32, nil, nil, 33,
|
|
33, nil, nil, 32, 33, nil, 33, 32, nil, 34,
|
|
34, nil, nil, 33, 34, 32, 34, 33, nil, 35,
|
|
35, nil, nil, 34, 35, 33, 35, 34, nil, 36,
|
|
36, nil, nil, 35, 36, 34, 36, 35, nil, 37,
|
|
37, nil, nil, 36, 37, 35, 37, 36, nil, 38,
|
|
38, nil, nil, 37, 38, 36, 38, 37, nil, 39,
|
|
39, nil, nil, 38, 39, 37, 39, 38, nil, 43,
|
|
43, 43, nil, 39, 43, 38, 43, 39, nil, 74,
|
|
74, nil, nil, 43, 74, 39, 74, 43, nil, 5,
|
|
5, nil, nil, 74, 5, 43, 5, 74, nil, 14,
|
|
14, nil, nil, 5, 14, 74, 14, 5, nil, 18,
|
|
18, nil, nil, 14, 18, 5, 18, 14, nil, 19,
|
|
19, nil, nil, 18, 19, 14, 19, 18, nil, 21,
|
|
21, nil, nil, 19, 21, 18, 21, 19, nil, 22,
|
|
22, 22, nil, 21, 22, 19, 22, 21, nil, 25,
|
|
25, nil, nil, 22, 25, 21, 25, 22, nil, 27,
|
|
27, 22, nil, 25, 27, 22, 27, 25, nil, 28,
|
|
28, nil, nil, 27, 28, 25, 28, 27, nil, 29,
|
|
29, nil, nil, 28, 29, 27, 29, 28, nil, 52,
|
|
52, nil, nil, 29, 52, 28, 52, 29, nil, 76,
|
|
76, nil, nil, 52, 76, 29, 76, 52, nil, 97,
|
|
97, 52, nil, 76, 97, 52, 97, 76, nil, 102,
|
|
102, nil, 58, 97, 102, 76, 102, 97, nil, 58,
|
|
nil, 97, 58, 102, nil, 97, 66, 102, nil, 58,
|
|
58, 102, nil, 66, nil, 102, 66, 66, 66, 66,
|
|
66, 66, 66, 66, 66, 66, 60, 66, nil, nil,
|
|
nil, nil, nil, 60, nil, nil, 60, nil, 61, nil,
|
|
nil, nil, 60, 60, 60, 61, nil, 60, 61, nil,
|
|
62, nil, nil, nil, 61, 61, 61, 62, nil, 61,
|
|
62, nil, 63, nil, nil, nil, 62, 62, 62, 63,
|
|
nil, 62, 63, nil, 64, nil, nil, nil, 63, 63,
|
|
63, 64, nil, 63, 64, nil, 65, nil, nil, nil,
|
|
64, 64, 64, 65, nil, 64, 65, nil, 59, nil,
|
|
nil, nil, 65, 65, 65, 59, nil, 65, 59, nil,
|
|
nil, nil, nil, nil, nil, 59, 59 ]
|
|
|
|
racc_action_pointer = [
|
|
18, 95, 67, 90, -1, 374, 140, 166, nil, nil,
|
|
nil, 139, 41, 62, 384, nil, nil, nil, 394, 404,
|
|
nil, 414, 424, nil, nil, 434, 113, 444, 454, 464,
|
|
251, 254, 274, 284, 294, 304, 314, 324, 334, 344,
|
|
92, nil, nil, 354, 208, 49, 69, -2, -24, 185,
|
|
nil, nil, 474, 162, 15, -1, 20, 43, 509, 615,
|
|
543, 555, 567, 579, 591, 603, 523, 231, nil, 123,
|
|
113, 70, 111, nil, 364, nil, 484, nil, nil, 21,
|
|
nil, 113, nil, nil, 0, nil, nil, nil, 116, nil,
|
|
nil, 38, nil, nil, 118, nil, 22, 494, nil, 93,
|
|
nil, -5, 504, 67, 47, nil, 136, 95, nil, 49,
|
|
nil, 139, nil ]
|
|
|
|
racc_action_default = [
|
|
-1, -57, -1, -1, -1, -57, -57, -57, -2, -3,
|
|
-4, -57, -57, -7, -57, -9, -10, -11, -57, -57,
|
|
-31, -35, -57, 113, -5, -57, -57, -57, -57, -57,
|
|
-57, -57, -57, -57, -57, -57, -57, -57, -57, -57,
|
|
-57, -6, -12, -40, -57, -16, -17, -34, -57, -57,
|
|
-46, -47, -57, -57, -15, -18, -19, -20, -21, -22,
|
|
-23, -24, -25, -26, -27, -28, -29, -30, -41, -43,
|
|
-40, -40, -57, -38, -57, -8, -35, -32, -45, -57,
|
|
-48, -1, -13, -14, -57, -44, -37, -36, -40, -33,
|
|
-50, -57, -42, -39, -57, -49, -57, -57, -51, -57,
|
|
-52, -1, -57, -57, -57, -54, -1, -57, -56, -57,
|
|
-53, -57, -55 ]
|
|
|
|
racc_goto_table = [
|
|
1, 11, 8, 9, 10, 48, 68, 100, 42, 50,
|
|
44, 72, 105, 73, 45, 46, 12, 80, 49, nil,
|
|
nil, 53, nil, 55, 56, 57, 58, 59, 60, 61,
|
|
62, 63, 64, 65, 66, 67, 78, nil, nil, 71,
|
|
85, 86, 95, nil, nil, nil, nil, nil, 79, 83,
|
|
92, nil, 108, nil, nil, 110, nil, nil, 93, 112,
|
|
89, nil, nil, nil, nil, nil, 90, nil, nil, nil,
|
|
88, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
nil, 91, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
nil, nil, nil, 99, nil, nil, nil, nil, 104, nil,
|
|
nil, 103, nil, nil, nil, nil, 109 ]
|
|
|
|
racc_goto_check = [
|
|
1, 4, 1, 1, 1, 9, 12, 17, 8, 14,
|
|
4, 10, 18, 11, 4, 4, 5, 15, 4, nil,
|
|
nil, 4, nil, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 14, nil, nil, 4,
|
|
11, 11, 16, nil, nil, nil, nil, nil, 4, 8,
|
|
12, nil, 16, nil, nil, 16, nil, nil, 11, 16,
|
|
9, nil, nil, nil, nil, nil, 14, nil, nil, nil,
|
|
4, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
nil, 1, nil, nil, nil, nil, nil, nil, nil, nil,
|
|
nil, nil, nil, 4, nil, nil, nil, nil, 4, nil,
|
|
nil, 1, nil, nil, nil, nil, 1 ]
|
|
|
|
racc_goto_pointer = [
|
|
nil, 0, nil, nil, -4, 11, nil, nil, -5, -16,
|
|
-32, -30, -34, nil, -13, -35, -52, -90, -90 ]
|
|
|
|
racc_goto_default = [
|
|
nil, nil, 3, 4, 47, nil, 20, 17, nil, nil,
|
|
nil, nil, nil, 69, nil, nil, nil, nil, nil ]
|
|
|
|
racc_reduce_table = [
|
|
0, 0, :racc_error,
|
|
0, 37, :_reduce_1,
|
|
2, 37, :_reduce_2,
|
|
2, 37, :_reduce_3,
|
|
2, 37, :_reduce_4,
|
|
3, 38, :_reduce_5,
|
|
3, 38, :_reduce_6,
|
|
1, 42, :_reduce_none,
|
|
3, 42, :_reduce_8,
|
|
1, 40, :_reduce_none,
|
|
1, 40, :_reduce_none,
|
|
1, 40, :_reduce_none,
|
|
2, 40, :_reduce_12,
|
|
4, 40, :_reduce_13,
|
|
4, 40, :_reduce_14,
|
|
3, 40, :_reduce_15,
|
|
2, 40, :_reduce_16,
|
|
2, 40, :_reduce_17,
|
|
3, 40, :_reduce_18,
|
|
3, 40, :_reduce_19,
|
|
3, 40, :_reduce_20,
|
|
3, 40, :_reduce_21,
|
|
3, 40, :_reduce_22,
|
|
3, 40, :_reduce_23,
|
|
3, 40, :_reduce_24,
|
|
3, 40, :_reduce_25,
|
|
3, 40, :_reduce_26,
|
|
3, 40, :_reduce_27,
|
|
3, 40, :_reduce_28,
|
|
3, 40, :_reduce_29,
|
|
3, 40, :_reduce_30,
|
|
1, 40, :_reduce_none,
|
|
3, 43, :_reduce_32,
|
|
3, 45, :_reduce_33,
|
|
1, 45, :_reduce_34,
|
|
0, 45, :_reduce_35,
|
|
3, 44, :_reduce_36,
|
|
2, 46, :_reduce_37,
|
|
1, 46, :_reduce_38,
|
|
3, 47, :_reduce_39,
|
|
0, 47, :_reduce_40,
|
|
3, 41, :_reduce_41,
|
|
3, 48, :_reduce_42,
|
|
1, 48, :_reduce_43,
|
|
2, 49, :_reduce_44,
|
|
4, 39, :_reduce_45,
|
|
3, 39, :_reduce_46,
|
|
1, 50, :_reduce_47,
|
|
2, 50, :_reduce_48,
|
|
4, 51, :_reduce_49,
|
|
2, 51, :_reduce_50,
|
|
2, 52, :_reduce_51,
|
|
2, 52, :_reduce_52,
|
|
4, 53, :_reduce_53,
|
|
3, 53, :_reduce_54,
|
|
4, 54, :_reduce_55,
|
|
2, 54, :_reduce_56 ]
|
|
|
|
racc_reduce_n = 57
|
|
|
|
racc_shift_n = 113
|
|
|
|
racc_token_table = {
|
|
false => 0,
|
|
:error => 1,
|
|
:comma => 2,
|
|
:dot => 3,
|
|
:endtag => 4,
|
|
:ident => 5,
|
|
:integer => 6,
|
|
:keyword => 7,
|
|
:lblock => 8,
|
|
:lblock2 => 9,
|
|
:lbracket => 10,
|
|
:linterp => 11,
|
|
:lparen => 12,
|
|
:op_div => 13,
|
|
:op_eq => 14,
|
|
:op_gt => 15,
|
|
:op_geq => 16,
|
|
:op_lt => 17,
|
|
:op_leq => 18,
|
|
:op_minus => 19,
|
|
:op_mod => 20,
|
|
:op_mul => 21,
|
|
:op_neq => 22,
|
|
:op_not => 23,
|
|
:op_plus => 24,
|
|
:pipe => 25,
|
|
:plaintext => 26,
|
|
:rblock => 27,
|
|
:rbracket => 28,
|
|
:rinterp => 29,
|
|
:rparen => 30,
|
|
:string => 31,
|
|
:tag_ident => 32,
|
|
:op_uminus => 33,
|
|
:op_and => 34,
|
|
:op_or => 35 }
|
|
|
|
racc_nt_base = 36
|
|
|
|
racc_use_result_var = true
|
|
|
|
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",
|
|
"comma",
|
|
"dot",
|
|
"endtag",
|
|
"ident",
|
|
"integer",
|
|
"keyword",
|
|
"lblock",
|
|
"lblock2",
|
|
"lbracket",
|
|
"linterp",
|
|
"lparen",
|
|
"op_div",
|
|
"op_eq",
|
|
"op_gt",
|
|
"op_geq",
|
|
"op_lt",
|
|
"op_leq",
|
|
"op_minus",
|
|
"op_mod",
|
|
"op_mul",
|
|
"op_neq",
|
|
"op_not",
|
|
"op_plus",
|
|
"pipe",
|
|
"plaintext",
|
|
"rblock",
|
|
"rbracket",
|
|
"rinterp",
|
|
"rparen",
|
|
"string",
|
|
"tag_ident",
|
|
"op_uminus",
|
|
"op_and",
|
|
"op_or",
|
|
"$start",
|
|
"block",
|
|
"interp",
|
|
"tag",
|
|
"expr",
|
|
"filter_chain",
|
|
"primary_expr",
|
|
"tuple",
|
|
"function_args",
|
|
"tuple_content",
|
|
"function_args_inside",
|
|
"function_keywords",
|
|
"filter_chain_cont",
|
|
"filter_call",
|
|
"tag_first_cont",
|
|
"tag_first_cont2",
|
|
"tag_next_cont",
|
|
"tag_next_cont2",
|
|
"tag_next_cont3" ]
|
|
|
|
Racc_debug_parser = false
|
|
|
|
##### State transition tables end #####
|
|
|
|
# reduce 0 omitted
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 47)
|
|
def _reduce_1(val, _values, result)
|
|
result = []
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 49)
|
|
def _reduce_2(val, _values, result)
|
|
result = [ val[0], *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 51)
|
|
def _reduce_3(val, _values, result)
|
|
result = [ val[0], *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 53)
|
|
def _reduce_4(val, _values, result)
|
|
result = [ val[0], *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 57)
|
|
def _reduce_5(val, _values, result)
|
|
result = [ :interp, retag(val), val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 59)
|
|
def _reduce_6(val, _values, result)
|
|
result = [ :interp, retag(val), val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
# reduce 7 omitted
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 64)
|
|
def _reduce_8(val, _values, result)
|
|
result = [ val[1][0], retag(val), *val[1][2..-1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
# reduce 9 omitted
|
|
|
|
# reduce 10 omitted
|
|
|
|
# reduce 11 omitted
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 71)
|
|
def _reduce_12(val, _values, result)
|
|
result = [ :call, retag(val), val[0], val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 73)
|
|
def _reduce_13(val, _values, result)
|
|
result = [ :index, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 75)
|
|
def _reduce_14(val, _values, result)
|
|
result = [ :external, retag(val), val[0], val[2], val[3] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 77)
|
|
def _reduce_15(val, _values, result)
|
|
result = [ :external, retag(val), val[0], val[2], nil ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 79)
|
|
def _reduce_16(val, _values, result)
|
|
result = [ :uminus, retag(val), val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 81)
|
|
def _reduce_17(val, _values, result)
|
|
result = [ :not, retag(val), val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 83)
|
|
def _reduce_18(val, _values, result)
|
|
result = [ :mul, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 85)
|
|
def _reduce_19(val, _values, result)
|
|
result = [ :div, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 87)
|
|
def _reduce_20(val, _values, result)
|
|
result = [ :mod, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 89)
|
|
def _reduce_21(val, _values, result)
|
|
result = [ :plus, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 91)
|
|
def _reduce_22(val, _values, result)
|
|
result = [ :minus, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 93)
|
|
def _reduce_23(val, _values, result)
|
|
result = [ :eq, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 95)
|
|
def _reduce_24(val, _values, result)
|
|
result = [ :neq, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 97)
|
|
def _reduce_25(val, _values, result)
|
|
result = [ :lt, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 99)
|
|
def _reduce_26(val, _values, result)
|
|
result = [ :leq, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 101)
|
|
def _reduce_27(val, _values, result)
|
|
result = [ :gt, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 103)
|
|
def _reduce_28(val, _values, result)
|
|
result = [ :geq, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 105)
|
|
def _reduce_29(val, _values, result)
|
|
result = [ :and, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 107)
|
|
def _reduce_30(val, _values, result)
|
|
result = [ :or, retag(val), val[0], val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
# reduce 31 omitted
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 112)
|
|
def _reduce_32(val, _values, result)
|
|
result = [ :tuple, retag(val), val[1].compact ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 116)
|
|
def _reduce_33(val, _values, result)
|
|
result = [ val[0], *val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 118)
|
|
def _reduce_34(val, _values, result)
|
|
result = [ val[0] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 120)
|
|
def _reduce_35(val, _values, result)
|
|
result = [ ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 124)
|
|
def _reduce_36(val, _values, result)
|
|
result = [ :args, retag(val), *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 128)
|
|
def _reduce_37(val, _values, result)
|
|
result = [ val[0], val[1][2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 130)
|
|
def _reduce_38(val, _values, result)
|
|
result = [ nil, val[0][2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 134)
|
|
def _reduce_39(val, _values, result)
|
|
name = val[0][2].to_sym
|
|
tail = val[2][2]
|
|
loc = retag([ val[0], val[1] ])
|
|
|
|
if tail.include? name
|
|
@errors << SyntaxError.new("duplicate keyword argument `#{val[0][2]}'",
|
|
tail[name][1])
|
|
end
|
|
|
|
hash = {
|
|
name => [ val[1][0], loc, *val[1][2..-1] ]
|
|
}.merge(tail)
|
|
|
|
result = [ :keywords, retag([ loc, val[2] ]), hash ]
|
|
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 150)
|
|
def _reduce_40(val, _values, result)
|
|
result = [ :keywords, nil, {} ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 154)
|
|
def _reduce_41(val, _values, result)
|
|
result = [ val[0], *val[2] ].
|
|
reduce { |tree, node| node[3][2] = tree; node }
|
|
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 160)
|
|
def _reduce_42(val, _values, result)
|
|
result = [ val[0], *val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 162)
|
|
def _reduce_43(val, _values, result)
|
|
result = [ val[0] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 166)
|
|
def _reduce_44(val, _values, result)
|
|
ident_loc = val[0][1]
|
|
empty_args_loc = { line: ident_loc[:line],
|
|
start: ident_loc[:end] + 1,
|
|
end: ident_loc[:end] + 1, }
|
|
result = [ :call, val[0][1], val[0],
|
|
[ :args, val[1][1] || empty_args_loc, nil, val[1][2] ] ]
|
|
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 176)
|
|
def _reduce_45(val, _values, result)
|
|
result = [ :tag, retag(val), val[1], val[2], *reduce_tag_args(val[3][2]) ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 178)
|
|
def _reduce_46(val, _values, result)
|
|
result = [ :tag, retag(val), val[1], nil, *reduce_tag_args(val[2][2]) ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 186)
|
|
def _reduce_47(val, _values, result)
|
|
result = [ :cont, retag(val), [] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 188)
|
|
def _reduce_48(val, _values, result)
|
|
result = [ :cont, retag(val), [ val[0], *val[1][2] ] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 192)
|
|
def _reduce_49(val, _values, result)
|
|
result = [ :cont2, val[0][1], [ [:block, val[0][1], val[1] ], *val[3] ] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 194)
|
|
def _reduce_50(val, _values, result)
|
|
result = [ :cont2, retag(val), [ val[0], *val[1][2] ] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 198)
|
|
def _reduce_51(val, _values, result)
|
|
result = []
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 200)
|
|
def _reduce_52(val, _values, result)
|
|
result = [ val[0], *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 204)
|
|
def _reduce_53(val, _values, result)
|
|
result = [ [:block, val[0][1], val[1] ], *val[3] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 206)
|
|
def _reduce_54(val, _values, result)
|
|
result = [ val[0], val[1], *val[2] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 210)
|
|
def _reduce_55(val, _values, result)
|
|
result = [ [:block, val[0][1], val[1] ], *val[3] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
module_eval(<<'.,.,', 'liquor.y', 212)
|
|
def _reduce_56(val, _values, result)
|
|
result = [ val[0], *val[1] ]
|
|
result
|
|
end
|
|
.,.,
|
|
|
|
def _reduce_none(val, _values, result)
|
|
val[0]
|
|
end
|
|
|
|
end # class Parser
|
|
end # module Liquor
|