Giter Club home page Giter Club logo

racc's Introduction

Racc

DESCRIPTION:

Racc is an LALR(1) parser generator.
It is written in Ruby itself, and generates Ruby program.

Requirement

*  Ruby 2.5 or later.

Installation

gem install:

  $ gem install racc

Testing Racc

Racc comes with simple calculator. To compile this, on shell:

    $ racc -o calc calc.y

This process costs few seconds (or less). Then type:

    $ ruby calc

... Does it work?
For details of Racc, see HTML documents placed under 'doc/en/'
and sample grammar files under 'sample/'.

Release flow

  • Update VERSION number of these files

    • RACC_VERSION in “ext/racc/com/headius/racc/Cparse.java”

    • VERSION in “lib/racc/info.rb”

  • Release as a gem by rake release with CRuby and JRuby because Racc gem provides 2 packages

  • Create new release on GitHub

License

Racc is distributed under the same terms of ruby.
(see the file COPYING). Note that you do NOT need to follow
ruby license for your own parser (racc outputs).
You can distribute those files under any licenses you want.

Bug Reports

Any kind of bug report is welcome.
If you find a bug of Racc, please report an issue at 
https://github.com/ruby/racc/issues. Your grammar file,
debug output generated by "racc -g", are helpful.

                                                    Minero Aoki
                                            [email protected]
                                          http://i.loveruby.net

racc's People

Contributors

ahorek avatar akimd avatar alexdowad avatar amatsuda avatar aycabta avatar byroot avatar dependabot[bot] avatar drbrain avatar enebo avatar eregon avatar flavorjones avatar headius avatar hkdnet avatar hsbt avatar jeremyevans avatar jwillemsen avatar k-tsj avatar koic avatar mame avatar marcandre avatar matzbot avatar nobu avatar nurse avatar olleolleolle avatar shyouhei avatar stomar avatar tenderlove avatar ydah avatar yui-knk avatar zenspider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

racc's Issues

Racc doesn't run on JRuby 9000-pre1

Using racc 1.4.12 on JRuby 9000-pre1 produces errors such as the following:

Cparse.java:738:in `call_lexer': java.lang.NoSuchMethodError: org.jruby.runtime.ThreadContext.getFrameJumpTarget()I
        from Cparse.java:729:in `racc_yyparse'
        from Cparse$Parser$INVOKER$i$1$0$racc_yyparse.gen:-1:in `call'
        from JavaMethod.java:691:in `call'
        from RubyClass.java:541:in `finvoke'
        from RubyBasicObject.java:1634:in `send19'
        from RubyBasicObject$INVOKER$i$send19.gen:-1:in `call'
        from CachingCallSite.java:272:in `cacheAndCall'
        from CachingCallSite.java:78:in `callBlock'
        from CachingCallSite.java:82:in `call'
        from CallBase.java:388:in `interpret'
        from Interpreter.java:324:in `processCall'
        from Interpreter.java:551:in `interpret'
        from Interpreter.java:654:in `INTERPRET_METHOD'
        from InterpretedIRMethod.java:117:in `call'
        from CachingCallSite.java:272:in `cacheAndCall'
        from CachingCallSite.java:78:in `callBlock'
        from CachingCallSite.java:82:in `call'
        from CallBase.java:388:in `interpret'
        from Interpreter.java:320:in `processCall'
        from Interpreter.java:551:in `interpret'
        from Interpreter.java:654:in `INTERPRET_METHOD'
        from InterpretedIRMethod.java:117:in `call'
        from CachingCallSite.java:272:in `cacheAndCall'
        from CachingCallSite.java:78:in `callBlock'
        from CachingCallSite.java:82:in `call'
        from CallBase.java:388:in `interpret'
        from Interpreter.java:324:in `processCall'
        from Interpreter.java:551:in `interpret'
        from Interpreter.java:639:in `INTERPRET_BLOCK'
        from InterpretedIRBlockBody.java:74:in `commonYieldPath'
        from IRBlockBody.java:84:in `yieldSpecific'
        from Block.java:116:in `yieldSpecific'
        from IRRuntimeHelpers.java:450:in `yieldSpecific'
        from YieldInstr.java:58:in `interpret'
        from Interpreter.java:497:in `processOtherOp'
        from Interpreter.java:573:in `interpret'
        from Interpreter.java:654:in `INTERPRET_METHOD'
        from InterpretedIRMethod.java:147:in `call'
        from CachingCallSite.java:322:in `cacheAndCall'
        from CachingCallSite.java:172:in `callBlock'

Steps to reproduce:

git clone [email protected]:YorickPeterse/oga.git
bundle install
rake generate

cc @headius

Failures on test/test_racc_command

Using ruby-trunk patch level 36709

rake test
/home/zzak/.rvm/rubies/ruby-head/bin/ruby -w -I.:lib/psych:lib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_scan_y.rb"; require "test/test_grammar_file_parser.rb"; require "test/test_racc_command.rb"; require "test/test_chk_y.rb"' -- 
Run options: --seed 39369

# Running tests:

...FFFFFFFFFFFFFF.FFFFFFFF.FF..

Finished tests in 3.609156s, 8.5893 tests/s, 14.6849 assertions/s.

  1) Failure:
test_chk_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:36]:
invalid option: -S


  2) Failure:
test_conf_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:63]:
invalid option: -S


  3) Failure:
test_digraph_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:133]:
invalid option: -S


  4) Failure:
test_echk_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:46]:
invalid option: -S


  5) Failure:
test_err_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:52]:
invalid option: -S


  6) Failure:
test_expect_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:107]:
invalid option: -S


  7) Failure:
test_firstline_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:122]:
invalid option: -S


  8) Failure:
test_ichk_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:95]:
invalid option: -S


  9) Failure:
test_intp_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:101]:
invalid option: -S


 10) Failure:
test_mailp_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:58]:
invalid option: -S


 11) Failure:
test_newsyn_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:23]:
invalid option: -S


 12) Failure:
test_noend_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:139]:
invalid option: -S


 13) Failure:
test_nonass_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:127]:
invalid option: -S


 14) Failure:
test_normal_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:28]:
invalid option: -S


 15) Failure:
test_nullbug1_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:112]:
invalid option: -S


 16) Failure:
test_nullbug2_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:117]:
invalid option: -S


 17) Failure:
test_opt_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:78]:
invalid option: -S


 18) Failure:
test_percent_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:11]:
invalid option: -S


 19) Failure:
test_recv_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:90]:
invalid option: -S


 20) Failure:
test_rrconf_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:68]:
invalid option: -S


 21) Failure:
test_scan_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:17]:
invalid option: -S


 22) Failure:
test_syntax_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:6]:
invalid option: -S


 23) Failure:
test_useless_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:73]:
invalid option: -S


 24) Failure:
test_yyerr_y(Racc::TestRaccCommand) [/home/zzak/projects/racc/test/test_racc_command.rb:84]:
invalid option: -S


31 tests, 53 assertions, 24 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [/home/zzak/.rvm/rubies/ruby-head/bin/ruby ...]

Tasks: TOP => test
(See full trace by running task with --trace)

JRuby test builds do not generate grammar_file_scanner.rb

There seems to be some file dependency issue with lib/racc/grammar_file_scanner.rb. It gets generated automatically based on dependencies when running rake test on CRuby, but it does not get generated on JRuby.

This causes the test suite to fail to start:

/home/travis/.rvm/rubies/jruby-9.2.4.0/bin/jruby -w -I.:lib/racc:lib:bin:test:. -e 'require "rubygems"; require "minitest/autorun"; require "test/test_chk_y.rb"; require "test/test_directed_graph.rb"; require "test/test_grammar_file_parser.rb"; require "test/test_racc_command.rb"; require "test/test_scan_y.rb"; require "test/test_scanner.rb"' -- 
Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
LoadError: no such file to load -- racc/grammar_file_scanner
  require at org/jruby/RubyKernel.java:976
   <main> at /home/travis/build/tenderlove/racc/lib/racc/grammar_file_parser.rb:10
  require at org/jruby/RubyKernel.java:976
   <main> at /home/travis/build/tenderlove/racc/test/helper.rb:1
  require at org/jruby/RubyKernel.java:976
   <main> at /home/travis/build/tenderlove/racc/test/helper.rb:7
  require at org/jruby/RubyKernel.java:976
   <main> at -e:1

I do not have an explanation for this, but I suspect some combination of rake-compiler and the various JRuby-specific conditionals in the Rakefile are interfering somehow. Note that the file does get generated when packaging the full gem, but it is not generated for rake test. For whatever reason, the test target does not end up depending on this file in the same way it is on CRuby.

I am patching it temporarily for #93 by forcibly generating it in the test script.

TestRaccCommand#test_executable_parser - windows failure

The below test is the only test failing on Windows MinGW, as the command won't run on Windows.

the following code:

def test_executable_parser
err = assert_compile 'echk.y', "-E -e ruby"
assert_no_warnings err
Dir.chdir(PROJECT_DIR) do
assert(system("#{TAB_DIR}/echk"))
end
end

changed to the below allows all tests to pass.

def test_executable_parser
  err = assert_compile 'echk.y', "-E -e ruby"
  assert_no_warnings err
  Dir.chdir(PROJECT_DIR) do
    if windows?
      assert(system "#{ruby_executable} ./#{TAB_DIR}/echk")
    else
      assert(system "#{TAB_DIR}/echk")
    end
  end
end

My tests don't pass

Do they for you?


10007 % git log -n 1 
commit 64931bf9e515da9b660ee3d524fdce190e966c29
Merge: ea14370 966b809
Author: Aaron Patterson <[email protected]>
Date:   Wed Nov 9 03:07:19 2011 -0800

    Merge pull request #5 from inukshuk/master

    Config is deprecated in Ruby 1.9.3 and 1.8.8
10008 % rake
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o cparse.bundle cparse.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64     -lruby  -lpthread -ldl  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:ext:lib" -I"/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib" "/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/test_chk_y.rb" "test/test_grammar_file_parser.rb" "test/test_racc_command.rb" "test/test_scan_y.rb" 
loading cparse
./lib/racc/parser.rb:46: warning: instance variable @yydebug not initialized
./lib/racc/parser.rb:46: warning: instance variable @action_table not initialized
./lib/racc/parser.rb:46: warning: instance variable @action_check not initialized
./lib/racc/parser.rb:46: warning: instance variable @action_default not initialized
./lib/racc/parser.rb:46: warning: instance variable @action_pointer not initialized
./lib/racc/parser.rb:46: warning: instance variable @goto_table not initialized
./lib/racc/parser.rb:46: warning: instance variable @goto_check not initialized
./lib/racc/parser.rb:46: warning: instance variable @goto_default not initialized
./lib/racc/parser.rb:46: warning: instance variable @goto_pointer not initialized
./lib/racc/parser.rb:46: warning: instance variable @nt_base not initialized
./lib/racc/parser.rb:46: warning: instance variable @nt_base not initialized
./lib/racc/parser.rb:46:in `initialize': no implicit conversion from nil to integer (TypeError)
    from ./lib/racc/parser.rb:46:in `new'
    from ./lib/racc/parser.rb:46
    from ./lib/racc/statetransitiontable.rb:12:in `require'
    from ./lib/racc/statetransitiontable.rb:12
    from ./lib/racc/state.rb:13:in `require'
    from ./lib/racc/state.rb:13
    from ./lib/racc.rb:4:in `require'
    from ./lib/racc.rb:4
    from ./lib/racc/static.rb:1:in `require'
    from ./lib/racc/static.rb:1
    from /Users/ryan/Work/git/racc/test/helper.rb:3:in `require'
    from /Users/ryan/Work/git/racc/test/helper.rb:3
    from /Users/ryan/Work/git/racc/test/test_chk_y.rb:1:in `require'
    from /Users/ryan/Work/git/racc/test/test_chk_y.rb:1
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `require'
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]

Push the -java gem

The 1-4-stable branch seems to include support for installing the racc gem under jruby, but it is not pushed to rubygems.org. @tenderlove, can you please push the gem so we could depend on it?

Include context in error messages

Currently racc will output something like this on a syntax error:

parse error on value ";" (SEMI)

which is not very useful if you've got semi-colons on every line of a 100KB file. Since line number and column number are apparently not possible (#15), the next best thing would be to include the context around the error.

Looking around at the variables available in on_error while debugging, I found the following useful bits of info:

@ss.pre_match - string leading up to the error
@ss.matched - string that caused the error
@ss.post_match - string after the error

So we could do something like:

parse error on value ";" (SEMI) in input "before context before context ; after context after context"

where the before and after context would be limited to a certain number of characters (10?).

I can make a pull request for this if I can get confirmation that this is a sensible approach.

header in several files are LGPL but refers to file Copying that is BSD-2-Clause

Hi, I'm referring to Racc level 1.4.16.
I've found that several files have this header:

You can distribute/modify this program under the terms of
the GNU LGPL, Lesser General Public License version 2.1.
For details of the GNU LGPL, see the file "COPYING".

But the file COPYING included in Racc is a BSD-2-Clause.

Could you please clarify if they are remained under LGPL 2.1?

Thanks.

racc --executable broken

Has no effect, the reason being that on line 76 of bin/racc you set executable=true but you meant make_executable=true so nothing gets copied to @params.

ERROR: Failed to build gem native extension

$ ruby -v
ruby 2.7.0dev (2019-02-08 trunk 67037) [x86_64-linux]

$ gem install racc
Building native extensions. This could take a while...
ERROR:  Error installing racc:
        ERROR: Failed to build gem native extension.

    current directory: /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/gems/racc-1.4.14/ext/racc
/home/u/.rbenv/versions/2.7.0-dev/bin/ruby -I /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/2.7.0 -r ./siteconf20190208-29225-1fcnlq9.rb extconf.rb
checking for rb_ary_subseq()... yes
creating Makefile

current directory: /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/gems/racc-1.4.14/ext/racc
make "DESTDIR=" clean

current directory: /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/gems/racc-1.4.14/ext/racc
make "DESTDIR="
make: *** No rule to make target '/home/u/.rbenv/versions/2.7.0-dev/include/ruby-2.7.0/defines.h', needed by 'cparse.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/gems/racc-1.4.14 for inspection.
Results logged to /home/u/.rbenv/versions/2.7.0-dev/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/racc-1.4.14/gem_make.out

Related to Ruby@67036?

Shebang mode fails on JRuby due to bash script launcher

The "shebang" mode for the parser generator does not work properly on some configurations of JRuby due to the jruby command being a bash script.

This leads to the following error in CI (see #93):

Failure:
Racc::TestRaccCommand#test_executable_parser [/Users/headius/projects/racc/test/test_racc_command.rb:57]:
Expected false to be truthy.

In many installs of JRuby, including the default tarball you can download from https://jruby.org, the jruby command is actually implemented using a bash script. Due to stupidity in the design of shebangs on most *nix systems, this means that the jruby script cannot be used directly in the shebang line of a Ruby script, because bash will attempt to execute both the jruby command and the target script with bash.

This is the reason that RubyGems with binscripts are usually installed using so-called "env shebangs" on JRuby, like so:

#!/usr/bin/env jruby

It is possible to install the jruby-launcher gem which will install a native jruby binary that works with the non-env shebang. This may be an option to get the test to pass, but it may be better to use an env shebang when generating the parser script.

Can't install gem on OS X 10.9.2

When I enter the command: sudo gem install racc, I get:

DRYer$ sudo gem install racc
Password:
Fetching: racc-1.4.11.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing racc:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for rb_ary_subseq()... yes
creating Makefile

make "DESTDIR="
compiling cparse.c
linking shared-object racc/cparse.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [cparse.bundle] Error 1

Anyway to get around this or have I found a real issue?

Cannot parse wildcard

So this is an issue from Rails, that went through Journey, and ended up with Racc. I would like to define the following route:

match '*', :to => 'controller#action'

Nevermind why, I would just like to greedily capture all URLs.

But I am getting this error:

Racc::ParseError Exception: 
parse error on value "(" (LPAREN)

Any thoughts?

Can't Run Tests

Hi, I'm running Ruby 2.6.4 via chruby. I clone this repository and then run bundle install --path vendor. I then run bundle exec rake. I get the following error:

** History.txt is missing or in the wrong format for auto-intuiting.
   run `sow blah` and look at its text files
mkdir -p tmp/x86_64-linux/cparse/2.6.4
cd tmp/x86_64-linux/cparse/2.6.4
/[...]/.rubies/ruby-2.6.4/bin/ruby -I. ../../../../ext/racc/extconf.rb
checking for rb_ary_subseq()... yes
creating Makefile
cd -
cd tmp/x86_64-linux/cparse/2.6.4
/usr/bin/make
compiling ../../../../ext/racc/cparse.c
linking shared-object racc/cparse.so
cd -
mkdir -p tmp/x86_64-linux/stage/lib/racc
cp COPYING tmp/x86_64-linux/stage/COPYING
cp DEPENDS tmp/x86_64-linux/stage/DEPENDS
cp Manifest.txt tmp/x86_64-linux/stage/Manifest.txt
cp README.ja.rdoc tmp/x86_64-linux/stage/README.ja.rdoc
cp README.rdoc tmp/x86_64-linux/stage/README.rdoc
cp Rakefile tmp/x86_64-linux/stage/Rakefile
cp TODO tmp/x86_64-linux/stage/TODO
mkdir -p tmp/x86_64-linux/stage/bin
cp bin/racc tmp/x86_64-linux/stage/bin/racc
mkdir -p tmp/x86_64-linux/stage/ext/racc
cp ext/racc/MANIFEST tmp/x86_64-linux/stage/ext/racc/MANIFEST
mkdir -p tmp/x86_64-linux/stage/ext/racc/com/headius/racc
cp ext/racc/com/headius/racc/Cparse.java tmp/x86_64-linux/stage/ext/racc/com/headius/racc/Cparse.java
cp ext/racc/cparse.c tmp/x86_64-linux/stage/ext/racc/cparse.c
cp ext/racc/depend tmp/x86_64-linux/stage/ext/racc/depend
cp ext/racc/extconf.rb tmp/x86_64-linux/stage/ext/racc/extconf.rb
cp lib/racc.rb tmp/x86_64-linux/stage/lib/racc.rb
cp lib/racc/color.rb tmp/x86_64-linux/stage/lib/racc/color.rb
cp lib/racc/directed_graph.rb tmp/x86_64-linux/stage/lib/racc/directed_graph.rb
cp lib/racc/dsl.rb tmp/x86_64-linux/stage/lib/racc/dsl.rb
cp lib/racc/exception.rb tmp/x86_64-linux/stage/lib/racc/exception.rb
cp lib/racc/grammar.rb tmp/x86_64-linux/stage/lib/racc/grammar.rb
cp lib/racc/grammar_file_parser.rb tmp/x86_64-linux/stage/lib/racc/grammar_file_parser.rb
ragel -F1 -R lib/racc/grammar_file_scanner.rl -o lib/racc/grammar_file_scanner.rb
rake aborted!
Command failed with status (127): [ragel -F1 -R lib/racc/grammar_file_scanner...]
/[...]/development/racc/Rakefile:115:in `block in <top (required)>'
/[...]/development/racc/vendor/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `load'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli/exec.rb:28:in `run'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli.rb:465:in `exec'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli.rb:27:in `dispatch'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/cli.rb:18:in `start'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/exe/bundle:30:in `block in <top (required)>'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/[...]/.gem/ruby/2.6.4/gems/bundler-2.0.2/exe/bundle:22:in `<top (required)>'
/[...]/.gem/ruby/2.6.4/bin/bundle:23:in `load'
/[...]/.gem/ruby/2.6.4/bin/bundle:23:in `<main>'
Tasks: TOP => default => test => compile => compile:x86_64-linux => compile:cparse:x86_64-linux => copy:cparse:x86_64-linux:2.6.4 => tmp/x86_64-linux/stage/lib/racc/grammar_file_scanner.rb => lib/racc/grammar_file_scanner.rb
(See full trace by running task with --trace)

What am I doing wrong? I've tried running bundle exec sow blah but I don't understand what I'm supposed to do with the files that it generates.

How to add "... expected {TOKEN}" to error messages?

Hi! I've been using Racc very happily with graphql-ruby for a while now. It's easy-to-use and fast, so thanks for maintaining it!

I'd like to improve the error messages to have some helpful info, for example, instead of:

Parse error on ")" at [1, 17]

I'd like to say:

Parse error on ")" at [1,17] (expected ":")

However, in reviewing the on_error docs, I don't see a way to access which token was expected. Is it possible to do that with Racc?

Thanks!

v1.4.15 does not install under JRuby

To reproduce:

$ rvm use jruby
Using /home/flavorjones/.rvm/gems/jruby-9.2.5.0

$ gem install racc -v 1.4.15
Building native extensions. This could take a while...
ERROR:  Error installing racc:
	ERROR: Failed to build gem native extension.

    current directory: /home/flavorjones/.rvm/gems/jruby-9.2.5.0/gems/racc-1.4.15/ext/racc
/home/flavorjones/.rvm/rubies/jruby-9.2.5.0/bin/jruby -r ./siteconf20190308-9330-hpy0c5.rb extconf.rb
checking for rb_ary_subseq()... 
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

        try_do at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:456
     try_link0 at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:541
      try_link at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:556
      try_func at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:765
     have_func at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:1051
  checking_for at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:942
      postpone at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:350
          open at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:350
          open at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:320
      postpone at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:346
  checking_for at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:941
     have_func at /home/flavorjones/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/mkmf.rb:1050
        <main> at extconf.rb:5
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/home/flavorjones/.rvm/rubies/jruby-9.2.5.0/bin/jruby

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/flavorjones/.rvm/gems/jruby-9.2.5.0/extensions/universal-java-10/2.5.0/racc-1.4.15/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/flavorjones/.rvm/gems/jruby-9.2.5.0/gems/racc-1.4.15 for inspection.
Results logged to /home/flavorjones/.rvm/gems/jruby-9.2.5.0/extensions/universal-java-10/2.5.0/racc-1.4.15/gem_make.out

Note that v1.4.14 installed fine under JRuby:

$ gem install racc -v 1.4.14
Successfully installed racc-1.4.14-java
1 gem installed

$ ruby -v
jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 OpenJDK 64-Bit Server VM 10.0.2+13-Ubuntu-1ubuntu0.18.04.4 on 10.0.2+13-Ubuntu-1ubuntu0.18.04.4 [linux-x86_64]

$ racc -o calc /home/flavorjones/.rvm/gems/jruby-9.2.5.0/gems/racc-1.4.14-java/sample/calc.y 

$ ruby calc

type "Q" to quit.


? 1 + 2
= 3

Tracking/accessing additional token information from the lexer

I'd like to track additional information (lineno, columno, newline) about each token that the lexer provides but racc requires each token to be a 2-element Array. I was writing a lexer to push on a third element which contained custom token attributes in a Hash, but Racc doesn't like that:

/Users/zdennis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `_racc_do_parse_c': next_token() returned wrong size of array (3 for 2) (ArgumentError)
from /Users/zdennis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/racc/parser.rb:99:in `do_parse'
from rscript.y:151:in `parse'
from rscript.tab.rb:343:in `<main>'

Is there a more appropriate way to store and retrieve this information or would it be possible to allow each token to be 3 elements with the 3rd being optional attributes?

Ruby 1.9 compatibilty issues

Does not work with some ruby 1.9 statements. (I can proved examples).

Is this a right place for creating bug issue ?

ParseError on ruby 2.1 required keyword arguments

I got a Racc::ParseError on a source file that contains required keyword arguments, eg.

def foo(bar, baz:, luz:) end

I was actually running flog at the time. Here's the relevant parts of the stack trace:

ruby/2.1.0/racc/parser.rb:529:in `on_error': lib/graph_matching/bipartite_graph.rb:159 :: parse error on value ":" (tSYMBEG) (Racc::ParseError)
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1095:in `on_error'
from ruby/2.1.0/racc/parser.rb:258:in `_racc_do_parse_c'
from ruby/2.1.0/racc/parser.rb:258:in `do_parse'
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1019:in `block in process'
from ruby/2.1.0/timeout.rb:82:in `block in timeout'
from ruby/2.1.0/timeout.rb:70:in `catch'
from ruby/2.1.0/timeout.rb:70:in `timeout'
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1007:in `process'
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1325:in `rescue in rescue in process'
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1322:in `rescue in process'
from ruby/gems/2.1.0/gems/ruby_parser-3.4.1/lib/ruby_parser_extras.rb:1320:in `process'

Line 159 looks like this:

    # lib/graph_matching/bipartite_graph.rb:159
    def add_to_set(set, vertex:, fail_if_in:)

Test failures are unhelpful

Current test failure output (stripped of noise) looks like this:

  1) Failure:
Racc::TestRaccCommand#test_bibtex [/Users/ryan/Work/git/tenderlove/racc/test/test_racc_command.rb:298]:
Output of test/assets/bibtex.y differed from expectation. Try compiling it and diff with test/regress/bibtex.rb:
ruby -Ilib bin/racc -o tmp/bibtex test/assets/bibtex.y; colordiff tmp/bibtex test/regress/bibtex.rb

That isn't helpful and it puts it on the developer to do extra work that the computer already knows.

Using assert_equal outputs:

  1) Failure:
Racc::TestRaccCommand#test_bibtex [/Users/ryan/Work/git/tenderlove/racc/test/test_racc_command.rb:298]:
--- expected
+++ actual
@@ -1,6 +1,6 @@
 "#
 # DO NOT MODIFY!!!!
-# This file was automatically generated by Racc 2.0.0-dev
+# This file was automatically generated by Racc 2.0.0.dev
 # (codename: Mecha Oishii) from Racc grammar file \"bibtex.y\".
 #

Which makes it obvious and trivial to fix.

Correctly document licenses

Currently the only top-level file describing licenses is COPYING, which only says that the project is LGPL.

However, parser.rb and the C and Java extensions are licensed under the same terms as Ruby (CRuby/MRI).

The docs at project root should be updated to reflect this.

See jruby/jruby#4603.

Enable automatic Travis CI builds on each PR

To keep Racc ticking smoothly, this is what @tenderlove needs to do! (WARNING: This issue contains a highly professional, impeccably edited screenshot! Do not make fun of it!)

  1. Open https://travis-ci.org/tenderlove/racc in your browser. If you already have a (free!) Travis CI account, it will look like this:

screenshot from 2015-11-03 21 13 09

  1. Scroll down and find "tenderlove/racc". Click the gray "X" button, it will turn to a green check.
  2. If you've never done this before, Travis CI will redirect to GitHub, where you have to authorize them to monitor your repositories.
  3. Make some small grammar or spelling fix (there are plenty to be made), commit to master, then push to the repo. This first push will trigger the first Travis CI build.
  4. You will find that the .travis.yml file is not set up properly to do a working build. I can sort that out and send you a PR.
  5. In future, every time someone sends a PR, Travis will automatically pull their code and run a build. I believe the results will appear right in the GitHub PR page! Don't, I said DON'T, press the "merge" button unless the build is green!
  6. When you want to work on the code yourself, commit to a topic branch and push the branch to this repo. That should trigger a Travis build of the new branch. If the build is green, go ahead and merge the branch into master.

Parse error on named argument in ruby 2.0

I posted this at Flay too, but I guess it should be here.

jon: ~> cat test.rb 
class Test
  def asdf(a, named_variable: 1)
  end
end
jon: ~> flog test.rb
ERROR: parsing ruby file test.rb
ERROR! Aborting. You may want to run with --continue.
/home/jon/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/racc/parser.rb:529:in `on_error': test.rb:2 :: parse error on value ":" (tCOLON) (Racc::ParseError)
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/ruby_parser-3.1.2/lib/ruby_parser_extras.rb:1055:in `on_error'
    from /home/jon/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/racc/parser.rb:258:in `_racc_do_parse_c'
    from /home/jon/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/racc/parser.rb:258:in `do_parse'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/ruby_parser-3.1.2/lib/ruby_parser_extras.rb:981:in `block in process'
    from /home/jon/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/timeout.rb:65:in `timeout'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/ruby_parser-3.1.2/lib/ruby_parser_extras.rb:971:in `process'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/ruby_parser-3.1.2/lib/ruby_parser_extras.rb:1292:in `rescue in process'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/ruby_parser-3.1.2/lib/ruby_parser_extras.rb:1290:in `process'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/lib/flog.rb:298:in `flog_ruby!'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/lib/flog.rb:268:in `flog_ruby'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/lib/flog.rb:258:in `block in flog'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/lib/flog.rb:253:in `each'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/lib/flog.rb:253:in `flog'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/gems/flog-3.2.3/bin/flog:13:in `<top (required)>'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/bin/flog:19:in `load'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/bin/flog:19:in `<main>'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/jon/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

Hope it helps, if not then Im sorry :)

Embedded parser mode fails on JRuby due to loaded feature diffs

The "embedded" mode that inlines racc sources fails to work on JRuby due to differences in how Ruby "loaded features" are managed. This leads to the following test failures:

Failure:
Racc::TestRaccCommand#test_echk_y [/Users/headius/projects/racc/test/test_racc_command.rb:50]:
LoadError: no such file to load -- racc/info
      require at org/jruby/RubyKernel.java:976
      require at /Users/headius/projects/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
       (eval) at racc/parser.rb:10
  module_eval at org/jruby/RubyModule.java:3054
       <main> at test/tab/echk:48

This happens because loaded features in JRuby are currently usually the full system path to the relevant file. The embedding logic attempts to short circuit e.g. racc/info by inserting racc/info.rb into the loaded features global.

This is a bug in JRuby but I am filing this to discuss whether we might come up with a more robust way to embed those sources, such as actually removing all requires rather than modifying loaded features directly.

Relates to #93.

Weak testing prevents drastic improvement

We all know racc could use a lot of cleanup, rework, and optimization. Unfortunately the tests available are a little weak, and folks involved are a bit worried about making drastic changes.

I'm starting this issue after talking to @tenderlove pointed out that we need better tests. I propose that in addition to trying to add unit tests, we could also get racc users like @whitequark and @yorickpeterse to help us incorporate their parsers and parser tests into an integration suite.

Thoughts?

segfault while building Opal (on ruby-2.0.0)

I have no clue about what the issue is, but maybe makes sense to you :)

I add that we often get segfaults on ruby2 only in opal builds, but restarting the job fixes them regularly (that's why they're not visible in the travis build history). If I remember well they're sometimes related to memory sweeping (I'm waiting for the next one to start a bug report on ruby-core).

here the stacktrace:
https://gist.github.com/elia/477126da67c68adb1801/raw/3787993cae79fb87eadc55721cbad7c527b75cf1/gistfile1.txt

from: https://travis-ci.org/opal/opal/builds/6990766

1.9 syntax support

Both flog and flay have problem with 1.9 syntax, and the problem seems to come from within racc.

See this issue: iain/metrical#5

It's not in my nature to post feature requests without also adding some code, but I don't know where to start with this, so I hope someone more knowledgeable will find the courage to tackle this one.

JRuby compatibility

@tenderlove,

I'm not sure if it's a JRuby issue or something related to racc itself.

I didn't tried to fix it yet because I'm not a C developer, I will need some time to detect what's wrong :)

That's the output on jruby-1.6.7.2:


Building native extensions.  This could take a while...
ERROR:  Error installing racc:
    ERROR: Failed to build gem native extension.

        /Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
creating Makefile

make
cc -I. -I/Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/lib/native/include -I/Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE      -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions    -arch x86_64 -c cparse.c
cparse.c:289:8: warning: implicit declaration of function 'rb_iter_break' is invalid in C99 [-Wimplicit-function-declaration]
       rb_iter_break(); 
       ^
cparse.c:672:12: warning: implicit declaration of function 'rb_catch' is invalid in C99 [-Wimplicit-function-declaration]
    code = rb_catch("racc_jump", reduce0, v->value_v);
           ^
2 warnings generated.
cc -dynamic -bundle -undefined dynamic_lookup  -o cparse.bundle cparse.o -L"." -L"/Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.5   -arch x86_64  
ld: library not found for -lbundle1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [cparse.bundle] Error 1


Gem files will remain installed in /Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/racc-1.4.8 for inspection.
Results logged to /Users/sobrinho/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/racc-1.4.8/ext/racc/gem_make.out

Similar error is happening on travis: http://travis-ci.org/#!/rails/journey/jobs/1935123

Probably @headius can confirm that it is related to JRuby :)

`master` branch is broken

On, the 1-4-stable branch, the tests pass. However, on master, there are many bugs which not only break the tests, but also make Racc completely unusable.

For example, in ext/racc/cparse.c, NUM2LONG is called on variables which were just set to Qnil, causing a no implicit conversion from nil to integer error. In the Ruby code, there are a number of places where methods are called with the wrong number of arguments, and so on.

I recommend that 1-4-stable can be used as the basis for a new master branch, and any commits which don't break the tests can be cherry-picked into the new master.

wrong number of arguments(2 for 4)

I have been using the gem and recently saw that there had been quite a few changes between the gem and what's in your master. Attempting to run the samples results in an error unfortunately.

bin/racc sample/array.y

/Users/zdennis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/racc/parser.rb:172:in `_racc_yyparse_c': wrong number of arguments(2 for 4) (ArgumentError)
from /Users/zdennis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/racc/parser.rb:172:in `yyparse'
from /Users/zdennis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/racc/grammarfileparser.rb:184:in `parse'
from bin/racc:143:in `block in main'
from bin/racc:277:in `section'
from bin/racc:141:in `main'
from bin/racc:308:in `<main>'

I'm not sure how this repos equates with what's in the stdlib, but having seen your and zenspider's names on some changes I thought I'd give it a shot. Does this repos relate to what's in stdlib or should I stop using it? TIA

Break non-GPL runtime out into a separate gem

Many organizations, like the Apache Software Foundation, refuse to ship any code that is GPL, LGPL, or variations thereof. This led to jruby/jruby#4603, where the LGPL portions of racc were mistakenly shipped with JRuby.

However, it's not easy to source just the non-LGPL parts of the racc gem. If you install the gem, you get mixed sources with mixed licenses (LGPL plus Ruby's licenses).

It would be best if the non-LGPL portions of racc could be split off into a separate "racc-runtime" gem that both JRuby and CRuby could use for redistribution.

I'm willing to help with this, but it really should just involve duplicating the project structure with just the non-LGPL portions as the "racc-runtime" gem, and adding a dependency on "racc-runtime" to "racc".

Does not work with Ruby2.6.0-rc1

Steps to reproduce:

$ git clone https://github.com/tenderlove/racc
$ cd racc
$ bundle install
$ ruby -v
ruby 2.6.0rc1 (2018-12-06 trunk 66253) [x86_64-linux]
$ bundle exec rake compile
$ for f in sample/*.y;do echo $f; bundle exec ruby -Ilib bin/racc $f -o /dev/null; done
sample/array.y
Error: sample/array.y:25: unexpected token "$"
sample/array2.y
Error: sample/array2.y:14: unexpected token "$"
sample/calc-ja.y
Error: sample/calc-ja.y:26: unexpected token "$"
sample/calc.y
Error: sample/calc.y:22: unexpected token "$"
sample/conflict.y
Error: sample/conflict.y:14: unexpected token "$"
sample/hash.y
Error: sample/hash.y:14: unexpected token "$"
sample/lalr.y
Error: sample/lalr.y:16: unexpected token "$"
sample/lists.y
Error: sample/lists.y:56: unexpected token "$"
sample/syntax.y
Error: sample/syntax.y:35: unexpected token "$"
sample/yyerr.y
Error: sample/yyerr.y:28: unexpected token "$"

bin/racc does not generate any *.rb files.
I'm not sure that this is caused by changes in Ruby2.6 or not.

require 'racc' after require 'racc/parser' will raise error

@alexdowad
install racc dev version 3f492b8 and run require"racc/parser"; require"racc" will raise error

$ gem list racc
*** LOCAL GEMS ***
racc (1.4.13)

$ racc --version
racc 2.0.0-dev, codename: Mecha Oishii (c core)

$ ruby -e 'p require"racc"; p require"racc/parser"; p "end" '
true
false
"end"

$ ruby -e 'p require"racc/parser"; p require"racc"; p "end" '
true
/usr/local/ruby_trunk/lib/ruby/gems/2.3.0/gems/racc-1.4.13/lib/racc/exception.rb:11:in `<module:Racc>': superclass mismatch for class ParseError (TypeError)
    from /usr/local/ruby_trunk/lib/ruby/gems/2.3.0/gems/racc-1.4.13/lib/racc/exception.rb:8:in `<top (required)>'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/ruby_trunk/lib/ruby/gems/2.3.0/gems/racc-1.4.13/lib/racc/grammar.rb:9:in `<top (required)>'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/ruby_trunk/lib/ruby/gems/2.3.0/gems/racc-1.4.13/lib/racc.rb:1:in `<top (required)>'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
    from /usr/local/ruby_trunk/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from -e:1:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.