Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
fe06e9ac
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fe06e9ac
编写于
5月 19, 2014
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make the AST go from left to right, rather than right to left
上级
dc2e3ea8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
45 deletion
+48
-45
actionpack/lib/action_dispatch/journey/parser.rb
actionpack/lib/action_dispatch/journey/parser.rb
+45
-43
actionpack/lib/action_dispatch/journey/parser.y
actionpack/lib/action_dispatch/journey/parser.y
+3
-2
未找到文件。
actionpack/lib/action_dispatch/journey/parser.rb
浏览文件 @
fe06e9ac
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.
9
# from Racc gramm
a
r file "".
# This file is automatically generated by Racc 1.4.
11
# from Racc gramm
e
r file "".
#
require
'racc/parser.rb'
...
...
@@ -9,42 +9,38 @@
require
'action_dispatch/journey/parser_extras'
module
ActionDispatch
module
Journey
# :nodoc:
class
Parser
<
Racc
::
Parser
# :nodoc:
module
Journey
class
Parser
<
Racc
::
Parser
##### State transition tables begin ###
racc_action_table
=
[
17
,
21
,
13
,
15
,
14
,
7
,
nil
,
16
,
8
,
19
,
13
,
15
,
14
,
7
,
23
,
16
,
8
,
19
,
13
,
15
,
14
,
7
,
nil
,
16
,
8
,
13
,
15
,
14
,
7
,
nil
,
16
,
8
,
13
,
15
,
14
,
7
,
nil
,
16
,
8
]
13
,
15
,
14
,
7
,
21
,
16
,
8
,
19
,
13
,
15
,
14
,
7
,
17
,
16
,
8
,
13
,
15
,
14
,
7
,
24
,
16
,
8
,
13
,
15
,
14
,
7
,
19
,
16
,
8
]
racc_action_check
=
[
1
,
17
,
1
,
1
,
1
,
1
,
nil
,
1
,
1
,
1
,
20
,
20
,
20
,
20
,
20
,
20
,
20
,
20
,
7
,
7
,
7
,
7
,
nil
,
7
,
7
,
19
,
19
,
19
,
19
,
nil
,
19
,
19
,
0
,
0
,
0
,
0
,
nil
,
0
,
0
]
2
,
2
,
2
,
2
,
17
,
2
,
2
,
2
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
19
,
19
,
19
,
19
,
20
,
19
,
19
,
7
,
7
,
7
,
7
,
22
,
7
,
7
]
racc_action_pointer
=
[
30
,
0
,
nil
,
nil
,
nil
,
nil
,
nil
,
16
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
1
,
nil
,
2
3
,
8
,
nil
,
nil
,
nil
]
6
,
12
,
-
2
,
nil
,
nil
,
nil
,
nil
,
20
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
4
,
nil
,
1
3
,
13
,
nil
,
17
,
nil
,
nil
]
racc_action_default
=
[
-
1
8
,
-
18
,
-
2
,
-
3
,
-
4
,
-
5
,
-
6
,
-
18
,
-
9
,
-
10
,
-
1
1
,
-
12
,
-
13
,
-
14
,
-
15
,
-
16
,
-
17
,
-
18
,
-
1
,
-
18
,
-
1
8
,
24
,
-
8
,
-
7
]
-
1
9
,
-
19
,
-
2
,
-
3
,
-
4
,
-
5
,
-
6
,
-
19
,
-
10
,
-
11
,
-
1
2
,
-
13
,
-
14
,
-
15
,
-
16
,
-
17
,
-
18
,
-
19
,
-
1
,
-
19
,
-
1
9
,
25
,
-
8
,
-
9
,
-
7
]
racc_goto_table
=
[
18
,
1
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
20
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
22
,
18
]
1
,
22
,
18
,
23
,
nil
,
nil
,
nil
,
20
]
racc_goto_check
=
[
2
,
1
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
1
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
2
,
2
]
1
,
2
,
1
,
3
,
nil
,
nil
,
nil
,
1
]
racc_goto_pointer
=
[
nil
,
1
,
-
1
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
0
,
-
18
,
-
16
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
]
racc_goto_default
=
[
...
...
@@ -61,19 +57,20 @@ class Parser < Racc::Parser # :nodoc:
1
,
12
,
:_reduce_none
,
3
,
15
,
:_reduce_7
,
3
,
13
,
:_reduce_8
,
1
,
16
,
:_reduce_9
,
3
,
13
,
:_reduce_9
,
1
,
16
,
:_reduce_10
,
1
,
14
,
:_reduce_none
,
1
,
14
,
:_reduce_none
,
1
,
14
,
:_reduce_none
,
1
,
14
,
:_reduce_none
,
1
,
19
,
:_reduce_1
4
,
1
,
17
,
:_reduce_1
5
,
1
,
18
,
:_reduce_1
6
,
1
,
20
,
:_reduce_1
7
]
1
,
19
,
:_reduce_1
5
,
1
,
17
,
:_reduce_1
6
,
1
,
18
,
:_reduce_1
7
,
1
,
20
,
:_reduce_1
8
]
racc_reduce_n
=
1
8
racc_reduce_n
=
1
9
racc_shift_n
=
2
4
racc_shift_n
=
2
5
racc_token_table
=
{
false
=>
0
,
...
...
@@ -137,12 +134,12 @@ class Parser < Racc::Parser # :nodoc:
# reduce 0 omitted
def
_reduce_1
(
val
,
_values
,
result
)
result
=
Cat
.
new
(
val
.
first
,
val
.
last
)
result
=
Cat
.
new
(
val
.
first
,
val
.
last
)
result
end
def
_reduce_2
(
val
,
_values
,
result
)
result
=
val
.
first
result
=
val
.
first
result
end
...
...
@@ -155,21 +152,24 @@ def _reduce_2(val, _values, result)
# reduce 6 omitted
def
_reduce_7
(
val
,
_values
,
result
)
result
=
Group
.
new
(
val
[
1
])
result
=
Group
.
new
(
val
[
1
])
result
end
def
_reduce_8
(
val
,
_values
,
result
)
result
=
Or
.
new
([
val
.
first
,
val
.
last
])
result
=
Or
.
new
([
val
.
first
,
val
.
last
])
result
end
def
_reduce_9
(
val
,
_values
,
result
)
result
=
Star
.
new
(
Symbol
.
new
(
val
.
last
))
result
=
Or
.
new
([
val
.
first
,
val
.
last
])
result
end
# reduce 10 omitted
def
_reduce_10
(
val
,
_values
,
result
)
result
=
Star
.
new
(
Symbol
.
new
(
val
.
last
))
result
end
# reduce 11 omitted
...
...
@@ -177,23 +177,25 @@ def _reduce_9(val, _values, result)
# reduce 13 omitted
def
_reduce_14
(
val
,
_values
,
result
)
result
=
Slash
.
new
(
'/'
)
result
end
# reduce 14 omitted
def
_reduce_15
(
val
,
_values
,
result
)
result
=
S
ymbol
.
new
(
val
.
first
)
result
=
S
lash
.
new
(
'/'
)
result
end
def
_reduce_16
(
val
,
_values
,
result
)
result
=
Literal
.
new
(
val
.
first
)
result
=
Symbol
.
new
(
val
.
first
)
result
end
def
_reduce_17
(
val
,
_values
,
result
)
result
=
Dot
.
new
(
val
.
first
)
result
=
Literal
.
new
(
val
.
first
)
result
end
def
_reduce_18
(
val
,
_values
,
result
)
result
=
Dot
.
new
(
val
.
first
)
result
end
...
...
actionpack/lib/action_dispatch/journey/parser.y
浏览文件 @
fe06e9ac
...
...
@@ -4,7 +4,7 @@ token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
rule
expressions
: expression
s expression
{ result = Cat.new(val.first, val.last) }
: expression
expressions
{ result = Cat.new(val.first, val.last) }
| expression { result = val.first }
| or
;
...
...
@@ -17,7 +17,8 @@ rule
: LPAREN expressions RPAREN { result = Group.new(val[1]) }
;
or
: expressions OR expression { result = Or.new([val.first, val.last]) }
: expression OR expression { result = Or.new([val.first, val.last]) }
| expression OR or { result = Or.new([val.first, val.last]) }
;
star
: STAR { result = Star.new(Symbol.new(val.last)) }
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录