racc 1.4.9-java → 1.4.12-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id: 75aee0ac3cd6429e28eac511d78a717614123a89 $
2
+ # $Id: f2d2788af2323ada1913f1dad5fea8aae4cc6830 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -478,7 +478,7 @@ module Racc
478
478
  end
479
479
 
480
480
  def unindent_auto(str)
481
- lines = str.to_a
481
+ lines = str.lines.to_a
482
482
  n = minimum_indent(lines)
483
483
  lines.map {|line| detab(line).sub(indent_re(n), '').rstrip + "\n" }.join('')
484
484
  end
data/test/helper.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  $VERBOSE = true
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
  require 'racc/static'
4
4
  require 'fileutils'
5
5
  require 'tempfile'
6
6
 
7
7
  module Racc
8
- class TestCase < Test::Unit::TestCase
8
+ class TestCase < MiniTest::Unit::TestCase
9
9
  PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
10
10
 
11
11
  TEST_DIR = File.join(PROJECT_DIR, 'test')
@@ -22,10 +22,6 @@ module Racc
22
22
  File.join(PROJECT_DIR, 'ext'),
23
23
  ].join(':')
24
24
 
25
- unless RUBY_VERSION >= '1.9'
26
- undef :default_test
27
- end
28
-
29
25
  def setup
30
26
  [OUT_DIR, TAB_DIR, LOG_DIR, ERR_DIR].each do |dir|
31
27
  FileUtils.mkdir_p(dir)
metadata CHANGED
@@ -1,62 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racc
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.4.9
4
+ version: 1.4.12
6
5
  platform: java
7
6
  authors:
8
7
  - Aaron Patterson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rdoc
16
15
  version_requirements: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - "~>"
17
+ - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: '3.10'
21
- none: false
19
+ version: '4.0'
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
- - - "~>"
22
+ - - ~>
25
23
  - !ruby/object:Gem::Version
26
- version: '3.10'
27
- none: false
24
+ version: '4.0'
28
25
  prerelease: false
29
26
  type: :development
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake-compiler
32
29
  version_requirements: !ruby/object:Gem::Requirement
33
30
  requirements:
34
- - - ">="
31
+ - - '>='
35
32
  - !ruby/object:Gem::Version
36
33
  version: 0.4.1
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
- - - ">="
36
+ - - '>='
41
37
  - !ruby/object:Gem::Version
42
38
  version: 0.4.1
43
- none: false
39
+ prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '4.7'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: '4.7'
44
53
  prerelease: false
45
54
  type: :development
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: hoe
48
57
  version_requirements: !ruby/object:Gem::Requirement
49
58
  requirements:
50
- - - "~>"
59
+ - - ~>
51
60
  - !ruby/object:Gem::Version
52
- version: '3.3'
53
- none: false
61
+ version: '3.12'
54
62
  requirement: !ruby/object:Gem::Requirement
55
63
  requirements:
56
- - - "~>"
64
+ - - ~>
57
65
  - !ruby/object:Gem::Version
58
- version: '3.3'
59
- none: false
66
+ version: '3.12'
60
67
  prerelease: false
61
68
  type: :development
62
69
  description: |-
@@ -78,10 +85,7 @@ extra_rdoc_files:
78
85
  - README.ja.rdoc
79
86
  - README.rdoc
80
87
  - rdoc/en/NEWS.en.rdoc
81
- - rdoc/en/debug.en.rdoc
82
88
  - rdoc/en/grammar.en.rdoc
83
- - rdoc/en/parser.en.rdoc
84
- - rdoc/en/usage.en.rdoc
85
89
  - rdoc/ja/NEWS.ja.rdoc
86
90
  - rdoc/ja/debug.ja.rdoc
87
91
  - rdoc/ja/grammar.ja.rdoc
@@ -102,6 +106,7 @@ files:
102
106
  - ext/racc/cparse.c
103
107
  - ext/racc/depend
104
108
  - ext/racc/extconf.rb
109
+ - ext/racc/com/headius/racc/Cparse.java
105
110
  - fastcache/extconf.rb
106
111
  - fastcache/fastcache.c
107
112
  - lib/racc.rb
@@ -123,12 +128,7 @@ files:
123
128
  - lib/racc/static.rb
124
129
  - misc/dist.sh
125
130
  - rdoc/en/NEWS.en.rdoc
126
- - rdoc/en/command.en.html
127
- - rdoc/en/debug.en.rdoc
128
131
  - rdoc/en/grammar.en.rdoc
129
- - rdoc/en/index.en.html
130
- - rdoc/en/parser.en.rdoc
131
- - rdoc/en/usage.en.rdoc
132
132
  - rdoc/ja/NEWS.ja.rdoc
133
133
  - rdoc/ja/command.ja.html
134
134
  - rdoc/ja/debug.ja.rdoc
@@ -192,42 +192,36 @@ files:
192
192
  - test/testscanner.rb
193
193
  - web/racc.en.rhtml
194
194
  - web/racc.ja.rhtml
195
- - ".gemtest"
195
+ - .gemtest
196
+ - lib/racc/cparse-jruby.jar
196
197
  homepage: http://i.loveruby.net/en/projects/racc/
197
- licenses: []
198
+ licenses:
199
+ - MIT
200
+ metadata: {}
198
201
  post_install_message:
199
202
  rdoc_options:
200
- - "--main"
203
+ - --main
201
204
  - README.rdoc
202
205
  require_paths:
203
- - !binary |-
204
- bGli
206
+ - lib
205
207
  required_ruby_version: !ruby/object:Gem::Requirement
206
208
  requirements:
207
- - - ">="
209
+ - - '>='
208
210
  - !ruby/object:Gem::Version
209
- version: !binary |-
210
- MA==
211
- none: false
211
+ version: '0'
212
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - ">="
214
+ - - '>='
215
215
  - !ruby/object:Gem::Version
216
- version: !binary |-
217
- MA==
218
- none: false
216
+ version: '0'
219
217
  requirements: []
220
- rubyforge_project: racc
221
- rubygems_version: 1.8.24
218
+ rubyforge_project:
219
+ rubygems_version: 2.1.9
222
220
  signing_key:
223
- specification_version: 3
221
+ specification_version: 4
224
222
  summary: Racc is a LALR(1) parser generator
225
223
  test_files:
226
- - !binary |-
227
- dGVzdC90ZXN0X2Noa195LnJi
228
- - !binary |-
229
- dGVzdC90ZXN0X2dyYW1tYXJfZmlsZV9wYXJzZXIucmI=
230
- - !binary |-
231
- dGVzdC90ZXN0X3JhY2NfY29tbWFuZC5yYg==
232
- - !binary |-
233
- dGVzdC90ZXN0X3NjYW5feS5yYg==
224
+ - test/test_chk_y.rb
225
+ - test/test_grammar_file_parser.rb
226
+ - test/test_racc_command.rb
227
+ - test/test_scan_y.rb
@@ -1,78 +0,0 @@
1
- <h1>Racc Command Reference</h1>
2
- <p>
3
- racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
4
- [-e<var>rubypath</var>] [--embedded=<var>rubypath</var>]
5
- [-v] [--verbose]
6
- [-O<var>filename</var>] [--log-file=<var>filename</var>]
7
- [-g] [--debug]
8
- [-E] [--embedded]
9
- [-l] [--no-line-convert]
10
- [-c] [--line-convert-all]
11
- [-a] [--no-omit-actions]
12
- [-C] [--check-only]
13
- [-S] [--output-status]
14
- [--version] [--copyright] [--help] <var>grammarfile</var>
15
- </p>
16
-
17
- <dl>
18
- <dt><var>filename</var>
19
- <dd>
20
- Racc grammar file. Any extention is permitted.
21
- </dd>
22
- <dt>-o<var>outfile</var>, --output-file=<var>outfile</var>
23
- <dd>
24
- A filename for output. default is &lt;filename&gt;.tab.rb
25
- </dd>
26
- <dt>-O<var>filename</var>, --log-file=<var>filename</var>
27
- <dd>
28
- Place logging output in file <var>filename</var>.
29
- Default log file name is <var>filename</var>.output.
30
- </dd>
31
- <dt>-e<var>rubypath</var>, --executable=<var>rubypath</var>
32
- <dd>
33
- output executable file(mode 755). <var>path</var> is a path of ruby interpreter.
34
- </dd>
35
- <dt>-v, --verbose
36
- <dd>
37
- verbose mode. create &lt;filename&gt;.output file, like yacc's y.output file.
38
- </dd>
39
- <dt>-g, --debug
40
- <dd>
41
- add debug code to parser class. To display debuggin information,
42
- use this '-g' option and set @yydebug true in parser class.
43
- </dd>
44
- <dt>-E, --embedded
45
- <dd>
46
- Output parser which doesn't need runtime files (racc/parser.rb).
47
- </dd>
48
- <dt>-C, --check-only
49
- <dd>
50
- Check syntax of racc grammer file and quit.
51
- </dd>
52
- <dt>-S, --output-status
53
- <dd>
54
- Print messages time to time while compiling.
55
- </dd>
56
- <dt>-l, --no-line-convert
57
- <dd>
58
- turns off line number converting.
59
- </dd>
60
- <dt>-c, --line-convert-all
61
- <dd>
62
- Convert line number of actions, inner, header and footer.
63
- <dt>-a, --no-omit-actions
64
- <dd>
65
- Call all actions, even if an action is empty.
66
- </dd>
67
- <dt>--version
68
- <dd>
69
- print Racc version and quit.
70
- </dd>
71
- <dt>--copyright
72
- <dd>
73
- Print copyright and quit.
74
- <dt>--help
75
- <dd>
76
- Print usage and quit.
77
- </dd>
78
- </dl>
@@ -1,20 +0,0 @@
1
- = Debugging
2
-
3
- == Racc reported syntax error.
4
-
5
- Isn't there too many "end"?
6
- grammar of racc file is changed in v0.10.
7
-
8
- Racc does not use '%' mark, while yacc uses huge number of '%' marks..
9
-
10
- == Racc reported "XXXX conflicts".
11
-
12
- Try "racc -v xxxx.y".
13
- It causes producing racc's internal log file, xxxx.output.
14
-
15
- == Generated parsers does not work correctly
16
-
17
- Try "racc -g xxxx.y".
18
- This command let racc generate "debugging parser".
19
- Then set @yydebug=true in your parser.
20
- It produces a working log of your parser.
@@ -1,10 +0,0 @@
1
- <h1>Racc User Manual</h1>
2
- <p>updated for version 1.4</p>
3
- <ul>
4
- <li><a href="usage.html">Usage</a>
5
- <li><a href="command.html">Racc Command Reference</a>
6
- <li><a href="grammar.html">Racc Grammar File Reference</a>
7
- <li><a href="parser.html">Racc::Parser class Reference</a>
8
- <li><a href="debug.html">Debugging Parser</a>
9
- <li><a href="NEWS.html">Release Note</a>
10
- </ul>
@@ -1,74 +0,0 @@
1
- = class Racc::Parser
2
-
3
- == Super Class
4
-
5
- Object
6
-
7
- == Instance Methods
8
-
9
- : do_parse -> Object
10
- The entry point of parser. This method is used with #next_token.
11
- If Racc wants to get token (and its value), calls next_token.
12
-
13
- --
14
- # Example
15
- ---- inner
16
- def parse
17
- @q = [[1,1],
18
- [2,2],
19
- [3,3],
20
- [false, '$']]
21
- do_parse
22
- end
23
-
24
- def next_token
25
- @q.shift
26
- end
27
- --
28
-
29
- : next_token -> [Symbol, Object]
30
- [abstract method]
31
-
32
- The method to fetch next token. If you use #do_parse method,
33
- you must implement #next_token. The format of return value is
34
- [TOKEN_SYMBOL, VALUE]. token-symbol is represented by Ruby's symbol
35
- by default, e.g. :IDENT for 'IDENT'. ";" (String) for ';'.
36
-
37
- The final symbol (End of file) must be false.
38
-
39
- : yyparse( receiver, method_id )
40
- The another entry point of parser.
41
- If you use this method, you must implement RECEIVER#METHOD_ID method.
42
-
43
- RECEIVER#METHOD_ID is a method to get next token.
44
- It must 'yield's token, which format is [TOKEN-SYMBOL, VALUE].
45
-
46
- : on_error( error_token_id, error_value, value_stack )
47
- This method is called when parse error is found.
48
-
49
- ERROR_TOKEN_ID is an internal ID of token which caused error.
50
- You can get string replesentation of this ID by calling
51
- #token_to_str.
52
-
53
- ERROR_VALUE is a value of error token.
54
-
55
- value_stack is a stack of symbol values.
56
- DO NOT MODIFY this object.
57
-
58
- This method raises ParseError by default.
59
-
60
- If this method returns, parsers enter "error recovering mode".
61
-
62
- : token_to_str( t ) -> String
63
- Convert internal ID of token symbol to the string.
64
-
65
- : yyerror
66
- Enter error recovering mode.
67
- This method does not call #on_error.
68
-
69
- : yyerrok
70
- Leave error recovering mode.
71
-
72
- : yyaccept
73
- Exit parser.
74
- Return value is Symbol_Value_Stack[0].
@@ -1,83 +0,0 @@
1
- = Usage
2
-
3
- == Generating Parser Using Racc
4
-
5
- To compile Racc grammar file, simply type:
6
-
7
- $ racc parse.y
8
-
9
- This creates ruby script file "parse.tab.y". The -o option can change the output filename.
10
-
11
- == Writing A Racc Grammar File
12
-
13
- If you want your own parser, you have to write a grammar file.
14
- A grammar file contains the name of your parser class, grammar for the parser,
15
- user code, and anything else.
16
- When writing a grammar file, yacc's knowledge is helpful.
17
- If you have not used yacc before, Racc is not too difficult.
18
-
19
- Here's an example Racc grammar file.
20
-
21
- class Calcparser
22
- rule
23
- target: exp { print val[0] }
24
-
25
- exp: exp '+' exp
26
- | exp '*' exp
27
- | '(' exp ')'
28
- | NUMBER
29
- end
30
-
31
- Racc grammar files resemble yacc files.
32
- But (of course), this is Ruby code.
33
- yacc's $$ is the 'result', $0, $1... is
34
- an array called 'val', and $-1, $-2... is an array called '_values'.
35
-
36
- == Parser
37
-
38
- Then you must prepare the parse entry method. There are two types of
39
- parse methods in Racc, Racc::Parser#do_parse and Racc::Parser#yyparse
40
-
41
- Racc::Parser#do_parse is simple.
42
-
43
- It's yyparse() of yacc, and Racc::Parser#next_token is yylex().
44
- This method must returns an array like [TOKENSYMBOL, ITS_VALUE].
45
- EOF is [false, false].
46
- (TOKENSYMBOL is a Ruby symbol (taken from String#intern) by default.
47
- If you want to change this, see the grammar reference.
48
-
49
- Racc::Parser#yyparse is little complicated, but useful.
50
- It does not use Racc::Parser#next_token, instead it gets tokens from any iterator.
51
-
52
- For example, <code>yyparse(obj, :scan)</code> causes
53
- calling +obj#scan+, and you can return tokens by yielding them from +obj#scan+.
54
-
55
- == Debugging
56
-
57
- When debugging, "-v" or/and the "-g" option is helpful.
58
-
59
- "-v" creates verbose log file (.output).
60
- "-g" creates a "Verbose Parser".
61
- Verbose Parser prints the internal status when parsing.
62
- But it's _not_ automatic.
63
- You must use -g option and set +@yydebug+ to +true+ in order to get output.
64
- -g option only creates the verbose parser.
65
-
66
- == Re-distributing Racc runtime
67
-
68
- A parser, which is created by Racc, requires the Racc runtime module;
69
- racc/parser.rb.
70
-
71
- Ruby 1.8.x comes with Racc runtime module,
72
- you need NOT distribute Racc runtime files.
73
-
74
- If you want to include the Racc runtime module with your parser.
75
- This can be done by using '-E' option:
76
-
77
- $ racc -E -omyparser.rb myparser.y
78
-
79
- This command creates myparser.rb which `includes' Racc runtime.
80
- Only you must do is to distribute your parser file (myparser.rb).
81
-
82
- Note: parser.rb is LGPL, but your parser is not.
83
- Your own parser is completely yours.