racc 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.ja.rdoc +0 -1
  3. data/README.rdoc +6 -7
  4. data/{rdoc → doc}/en/NEWS.en.rdoc +0 -0
  5. data/{rdoc → doc}/en/grammar.en.rdoc +27 -31
  6. data/doc/en/grammar2.en.rdoc +219 -0
  7. data/{rdoc → doc}/ja/NEWS.ja.rdoc +0 -0
  8. data/{rdoc → doc}/ja/command.ja.html +0 -0
  9. data/{rdoc → doc}/ja/debug.ja.rdoc +0 -0
  10. data/{rdoc → doc}/ja/grammar.ja.rdoc +0 -0
  11. data/{rdoc → doc}/ja/index.ja.html +0 -0
  12. data/{rdoc → doc}/ja/parser.ja.rdoc +0 -0
  13. data/{rdoc → doc}/ja/usage.ja.html +0 -0
  14. data/ext/racc/cparse/cparse.c +1 -1
  15. data/ext/racc/cparse/extconf.rb +1 -0
  16. data/lib/racc/info.rb +1 -1
  17. data/lib/racc/parser-text.rb +1 -1
  18. data/lib/racc/parser.rb +1 -1
  19. data/lib/racc/parserfilegenerator.rb +0 -44
  20. data/lib/racc/statetransitiontable.rb +2 -8
  21. metadata +15 -121
  22. data/Rakefile +0 -79
  23. data/ext/racc/com/headius/racc/Cparse.java +0 -849
  24. data/lib/racc/pre-setup +0 -13
  25. data/sample/array.y +0 -67
  26. data/sample/array2.y +0 -59
  27. data/sample/calc-ja.y +0 -66
  28. data/sample/calc.y +0 -65
  29. data/sample/conflict.y +0 -15
  30. data/sample/hash.y +0 -60
  31. data/sample/lalr.y +0 -17
  32. data/sample/lists.y +0 -57
  33. data/sample/syntax.y +0 -46
  34. data/sample/yyerr.y +0 -46
  35. data/test/assets/cadenza.y +0 -170
  36. data/test/assets/cast.y +0 -926
  37. data/test/assets/chk.y +0 -126
  38. data/test/assets/conf.y +0 -16
  39. data/test/assets/csspool.y +0 -729
  40. data/test/assets/digraph.y +0 -29
  41. data/test/assets/echk.y +0 -118
  42. data/test/assets/edtf.y +0 -583
  43. data/test/assets/err.y +0 -60
  44. data/test/assets/error_recovery.y +0 -35
  45. data/test/assets/expect.y +0 -7
  46. data/test/assets/firstline.y +0 -4
  47. data/test/assets/huia.y +0 -318
  48. data/test/assets/ichk.y +0 -102
  49. data/test/assets/intp.y +0 -546
  50. data/test/assets/journey.y +0 -47
  51. data/test/assets/liquor.y +0 -313
  52. data/test/assets/machete.y +0 -423
  53. data/test/assets/macruby.y +0 -2197
  54. data/test/assets/mailp.y +0 -437
  55. data/test/assets/mediacloth.y +0 -599
  56. data/test/assets/mof.y +0 -649
  57. data/test/assets/namae.y +0 -302
  58. data/test/assets/nasl.y +0 -626
  59. data/test/assets/newsyn.y +0 -25
  60. data/test/assets/noend.y +0 -4
  61. data/test/assets/nokogiri-css.y +0 -255
  62. data/test/assets/nonass.y +0 -41
  63. data/test/assets/normal.y +0 -27
  64. data/test/assets/norule.y +0 -4
  65. data/test/assets/nullbug1.y +0 -25
  66. data/test/assets/nullbug2.y +0 -15
  67. data/test/assets/opal.y +0 -1807
  68. data/test/assets/opt.y +0 -123
  69. data/test/assets/percent.y +0 -35
  70. data/test/assets/php_serialization.y +0 -98
  71. data/test/assets/recv.y +0 -97
  72. data/test/assets/riml.y +0 -665
  73. data/test/assets/rrconf.y +0 -14
  74. data/test/assets/ruby18.y +0 -1943
  75. data/test/assets/ruby19.y +0 -2174
  76. data/test/assets/ruby20.y +0 -2350
  77. data/test/assets/ruby21.y +0 -2359
  78. data/test/assets/ruby22.y +0 -2381
  79. data/test/assets/scan.y +0 -72
  80. data/test/assets/syntax.y +0 -50
  81. data/test/assets/tp_plus.y +0 -622
  82. data/test/assets/twowaysql.y +0 -278
  83. data/test/assets/unterm.y +0 -5
  84. data/test/assets/useless.y +0 -12
  85. data/test/assets/yyerr.y +0 -46
  86. data/test/bench.y +0 -36
  87. data/test/helper.rb +0 -115
  88. data/test/infini.y +0 -8
  89. data/test/regress/cadenza +0 -796
  90. data/test/regress/cast +0 -3428
  91. data/test/regress/csspool +0 -2314
  92. data/test/regress/edtf +0 -1794
  93. data/test/regress/huia +0 -1392
  94. data/test/regress/journey +0 -222
  95. data/test/regress/liquor +0 -885
  96. data/test/regress/machete +0 -833
  97. data/test/regress/mediacloth +0 -1463
  98. data/test/regress/mof +0 -1368
  99. data/test/regress/namae +0 -634
  100. data/test/regress/nasl +0 -2058
  101. data/test/regress/nokogiri-css +0 -836
  102. data/test/regress/opal +0 -6431
  103. data/test/regress/php_serialization +0 -336
  104. data/test/regress/riml +0 -3283
  105. data/test/regress/ruby18 +0 -6344
  106. data/test/regress/ruby22 +0 -7460
  107. data/test/regress/tp_plus +0 -1933
  108. data/test/regress/twowaysql +0 -556
  109. data/test/scandata/brace +0 -7
  110. data/test/scandata/gvar +0 -1
  111. data/test/scandata/normal +0 -4
  112. data/test/scandata/percent +0 -18
  113. data/test/scandata/slash +0 -10
  114. data/test/src.intp +0 -34
  115. data/test/start.y +0 -20
  116. data/test/test_chk_y.rb +0 -52
  117. data/test/test_grammar_file_parser.rb +0 -15
  118. data/test/test_racc_command.rb +0 -339
  119. data/test/test_scan_y.rb +0 -52
  120. data/test/testscanner.rb +0 -51
  121. data/web/racc.en.rhtml +0 -42
  122. data/web/racc.ja.rhtml +0 -51
data/test/assets/opt.y DELETED
@@ -1,123 +0,0 @@
1
- #
2
- # check options working
3
- #
4
-
5
- class Calcp
6
-
7
- prechigh
8
- left '*' '/'
9
- left '+' '-'
10
- preclow
11
-
12
- convert
13
- NUMBER 'Number'
14
- end
15
-
16
- options no_omit_action_call no_result_var
17
-
18
- rule
19
-
20
- target : exp | /* none */ { 0 } ;
21
-
22
- exp : exp '+' exp { chk(val[0] + val[2]) }
23
- | exp '-' exp { chk(val[0] - val[2]) }
24
- | exp '*' exp { chk(val[0] * val[2]) }
25
- | exp '/' exp { chk(val[0] / val[2]) }
26
- | '(' { $emb = true } exp ')'
27
- {
28
- raise 'must not happen' unless $emb
29
- val[2]
30
- }
31
- | '-' NUMBER { -val[1] }
32
- | NUMBER
33
- ;
34
-
35
- end
36
-
37
- ----header
38
-
39
- class Number; end
40
-
41
- ----inner
42
-
43
- def parse( src )
44
- @src = src
45
- do_parse
46
- end
47
-
48
- def next_token
49
- @src.shift
50
- end
51
-
52
- def initialize
53
- @yydebug = true
54
- end
55
-
56
- def chk( i )
57
- # p i
58
- i
59
- end
60
-
61
- ----footer
62
-
63
- $parser = Calcp.new
64
- $test_number = 1
65
-
66
- def chk( src, ans )
67
- result = $parser.parse(src)
68
- raise "test #{$test_number} failed" unless result == ans
69
- $test_number += 1
70
- end
71
-
72
- chk(
73
- [ [Number, 9],
74
- [false, false],
75
- [false, false] ], 9
76
- )
77
-
78
- chk(
79
- [ [Number, 5],
80
- ['*', nil],
81
- [Number, 1],
82
- ['-', nil],
83
- [Number, 1],
84
- ['*', nil],
85
- [Number, 8],
86
- [false, false],
87
- [false, false] ], -3
88
- )
89
-
90
- chk(
91
- [ [Number, 5],
92
- ['+', nil],
93
- [Number, 2],
94
- ['-', nil],
95
- [Number, 5],
96
- ['+', nil],
97
- [Number, 2],
98
- ['-', nil],
99
- [Number, 5],
100
- [false, false],
101
- [false, false] ], -1
102
- )
103
-
104
- chk(
105
- [ ['-', nil],
106
- [Number, 4],
107
- [false, false],
108
- [false, false] ], -4
109
- )
110
-
111
- chk(
112
- [ [Number, 7],
113
- ['*', nil],
114
- ['(', nil],
115
- [Number, 4],
116
- ['+', nil],
117
- [Number, 3],
118
- [')', nil],
119
- ['-', nil],
120
- [Number, 9],
121
- [false, false],
122
- [false, false] ], 40
123
- )
@@ -1,35 +0,0 @@
1
- class ScannerChecker
2
- rule
3
- target: A
4
- {
5
- i = 7
6
- i %= 4
7
- raise 'assert failed' unless i == 3
8
- tmp = %-This is percent string.-
9
- raise 'assert failed' unless tmp == 'This is percent string.'
10
- a = 5; b = 3
11
- assert_equal(2,(a%b)) #A
12
- # assert_equal(2,(a %b)) # is %-string
13
- assert_equal(2,(a% b)) #B
14
- assert_equal(2,(a % b)) #C
15
- }
16
- end
17
-
18
- ---- inner ----
19
-
20
- def parse
21
- @q = [[:A, 'A'], [false, '$']]
22
- do_parse
23
- end
24
-
25
- def next_token
26
- @q.shift
27
- end
28
-
29
- def assert_equal( expect, real )
30
- raise "expect #{expect.inspect} but #{real.inspect}" unless expect == real
31
- end
32
-
33
- ---- footer ----
34
-
35
- parser = ScannerChecker.new.parse
@@ -1,98 +0,0 @@
1
- # MIT License
2
- # See https://github.com/divoxx/ruby-php-serialization/blob/master/LICENSE.txt
3
-
4
- class PhpSerialization::Unserializer
5
- rule
6
-
7
- data : null ';' { @object = val[0] }
8
- | bool ';' { @object = val[0] }
9
- | integer ';' { @object = val[0] }
10
- | double ';' { @object = val[0] }
11
- | string ';' { @object = val[0] }
12
- | assoc_array { @object = val[0] }
13
- | object { @object = val[0] }
14
- ;
15
-
16
- null : 'N' { result = nil }
17
- ;
18
-
19
- bool : 'b' ':' NUMBER { result = Integer(val[2]) > 0 }
20
- ;
21
-
22
- integer : 'i' ':' NUMBER { result = Integer(val[2]) }
23
- ;
24
-
25
- double : 'd' ':' NUMBER { result = Float(val[2]) }
26
- ;
27
-
28
- string : 's' ':' NUMBER ':' STRING { result = val[4] }
29
- ;
30
-
31
- object : 'O' ':' NUMBER ':' STRING ':' NUMBER ':' '{' attribute_list '}'
32
- {
33
- if eval("defined?(#{val[4]})")
34
- result = Object.const_get(val[4]).new
35
-
36
- val[9].each do |(attr_name, value)|
37
- # Protected and private attributes will have a \0..\0 prefix
38
- attr_name = attr_name.gsub(/\A\\0[^\\]+\\0/, '')
39
- result.instance_variable_set("@#{attr_name}", value)
40
- end
41
- else
42
- klass_name = val[4].gsub(/^Struct::/, '')
43
- attr_names, values = [], []
44
-
45
- val[9].each do |(attr_name, value)|
46
- # Protected and private attributes will have a \0..\0 prefix
47
- attr_names << attr_name.gsub(/\A\\0[^\\]+\\0/, '')
48
- values << value
49
- end
50
-
51
- result = Struct.new(klass_name, *attr_names).new(*values)
52
- result.instance_variable_set("@_php_class", klass_name)
53
- end
54
- }
55
- ;
56
-
57
- attribute_list : attribute_list attribute { result = val[0] << val[1] }
58
- | { result = [] }
59
- ;
60
-
61
- attribute : data data { result = val }
62
- ;
63
-
64
- assoc_array : 'a' ':' NUMBER ':' '{' attribute_list '}'
65
- {
66
- # Checks if the keys are a sequence of integers
67
- idx = -1
68
- arr = val[5].all? { |(k,v)| k == (idx += 1) }
69
-
70
- if arr
71
- result = val[5].map { |(k,v)| v }
72
- else
73
- result = Hash[val[5]]
74
- end
75
- }
76
- ;
77
-
78
- end
79
-
80
- ---- header ----
81
- require 'php_serialization/tokenizer'
82
-
83
- ---- inner ----
84
- def initialize(tokenizer_klass = Tokenizer)
85
- @tokenizer_klass = tokenizer_klass
86
- end
87
-
88
- def run(string)
89
- @tokenizer = @tokenizer_klass.new(string)
90
- yyparse(@tokenizer, :each)
91
- return @object
92
- ensure
93
- @tokenizer = nil
94
- end
95
-
96
- def next_token
97
- @tokenizer.next_token
98
- end
data/test/assets/recv.y DELETED
@@ -1,97 +0,0 @@
1
- # s/r 5, r/r 10
2
- class A
3
- rule
4
-
5
- content: RecvH received
6
- ;
7
-
8
- datetime: day
9
- ;
10
-
11
- msgid: '<' spec '>';
12
-
13
- day:
14
- | ATOM ','
15
- ;
16
-
17
- received: recvitem_list recvdatetime
18
- ;
19
-
20
- recvitem_list:
21
- | recvitem_list recvitem
22
- ;
23
-
24
- recvitem: by | via | with | for ;
25
-
26
- by:
27
- | BY domain
28
- ;
29
-
30
- via:
31
- | VIA ATOM
32
- ;
33
-
34
- with: WITH ATOM
35
- ;
36
-
37
- for:
38
- | FOR addr
39
- ;
40
-
41
- recvdatetime:
42
- | ';' datetime
43
- ;
44
-
45
- addr: mbox | group ;
46
-
47
- mboxes: mbox
48
- | mboxes ',' mbox
49
- ;
50
-
51
- mbox: spec
52
- | routeaddr
53
- | phrase routeaddr
54
- ;
55
-
56
- group: phrase ':' mboxes ';'
57
- ;
58
-
59
- routeaddr: '<' route spec '>'
60
- | '<' spec '>'
61
- ;
62
-
63
- route: at_domains ':' ;
64
-
65
- at_domains: '@' domain
66
- | at_domains ',' '@' domain
67
- ;
68
-
69
- spec: local '@' domain
70
- | local
71
- ;
72
-
73
- local: word
74
- | local '.' word
75
- ;
76
-
77
- domain: domword
78
- | domain '.' domword
79
- ;
80
-
81
- domword: atom
82
- | DOMLIT
83
- | DIGIT
84
- ;
85
-
86
- phrase: word
87
- | phrase word
88
- ;
89
-
90
- word: atom
91
- | QUOTED
92
- | DIGIT
93
- ;
94
-
95
- atom: ATOM | FROM | BY | VIA | WITH | ID | FOR ;
96
-
97
- end