sydparse 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +26 -0
 - data/Rakefile +34 -0
 - data/bin/syd_pt_show +23 -0
 - data/env.h +66 -0
 - data/extconf.rb +12 -0
 - data/internal.h +716 -0
 - data/lex.c.tab +136 -0
 - data/lib/sydparse.rb +247 -0
 - data/node.h +365 -0
 - data/parse_override.h +14 -0
 - data/runtime.c +968 -0
 - data/runtime.h +195 -0
 - data/state.h +140 -0
 - data/sydparse.c +10325 -0
 - data/sydparse.y +6427 -0
 - data/test/class.rb +7 -0
 - data/test/pt.rb +19 -0
 - data/test/show.rb +20 -0
 - data/test/t.rb +53 -0
 - data/test/t3.rb +6 -0
 - data/test/t4.rb +4 -0
 - data/test/test.rb +2 -0
 - data/test/ubs.rb +1 -0
 - metadata +70 -0
 
    
        data/test/class.rb
    ADDED
    
    
    
        data/test/pt.rb
    ADDED
    
    
    
        data/test/show.rb
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            require 'sydparse'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pp'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            STDOUT.sync = true
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            path = ARGV.shift
         
     | 
| 
      
 8 
     | 
    
         
            +
            io = File.open(path)
         
     | 
| 
      
 9 
     | 
    
         
            +
            if ARGV.shift
         
     | 
| 
      
 10 
     | 
    
         
            +
                syd = SydneyParser.load_file io
         
     | 
| 
      
 11 
     | 
    
         
            +
                pp syd.sexp
         
     | 
| 
      
 12 
     | 
    
         
            +
                exit
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
            pp SydneyParser.unified_sexp(io)
         
     | 
| 
      
 15 
     | 
    
         
            +
            exit
         
     | 
| 
      
 16 
     | 
    
         
            +
            syd = SydneyParser.load_file io, false, true
         
     | 
| 
      
 17 
     | 
    
         
            +
            sx = syd.sexp(true)
         
     | 
| 
      
 18 
     | 
    
         
            +
            pp sx
         
     | 
| 
      
 19 
     | 
    
         
            +
            com = syd.comments
         
     | 
| 
      
 20 
     | 
    
         
            +
            p syd.collapse_per_line(com)
         
     | 
    
        data/test/t.rb
    ADDED
    
    | 
         @@ -0,0 +1,53 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            require 'sydparse'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'find'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'pp'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            STDOUT.sync = true
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            def test_file(path)
         
     | 
| 
      
 9 
     | 
    
         
            +
                pid = fork {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    print "#{path}: "
         
     | 
| 
      
 11 
     | 
    
         
            +
                    io = File.open(path)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    print "o"
         
     | 
| 
      
 13 
     | 
    
         
            +
                    syd = SydneyParser.load_file io
         
     | 
| 
      
 14 
     | 
    
         
            +
                    print "p"
         
     | 
| 
      
 15 
     | 
    
         
            +
                    sx = syd.sexp
         
     | 
| 
      
 16 
     | 
    
         
            +
                    # sx = []
         
     | 
| 
      
 17 
     | 
    
         
            +
                    # pp sx
         
     | 
| 
      
 18 
     | 
    
         
            +
                    print "x"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    sx.inspect
         
     | 
| 
      
 20 
     | 
    
         
            +
                    puts " ok"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    io.close
         
     | 
| 
      
 22 
     | 
    
         
            +
                    }
         
     | 
| 
      
 23 
     | 
    
         
            +
                    Process.wait(pid)
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            path = ARGV.shift
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            Find.find(path) do |path|
         
     | 
| 
      
 29 
     | 
    
         
            +
                next if File.directory?(path)
         
     | 
| 
      
 30 
     | 
    
         
            +
                if /\.rb$/.match(path)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    test_file(path)
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
            exit
         
     | 
| 
      
 35 
     | 
    
         
            +
            io = File.open(ARGV.shift)
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            syd = SydneyParser.load_file io
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            p syd
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            sx = syd.sexp
         
     | 
| 
      
 42 
     | 
    
         
            +
            p sx.size
         
     | 
| 
      
 43 
     | 
    
         
            +
            ary = sx[0]
         
     | 
| 
      
 44 
     | 
    
         
            +
            a3 = ary[2]
         
     | 
| 
      
 45 
     | 
    
         
            +
            # p a3.size
         
     | 
| 
      
 46 
     | 
    
         
            +
            # p a3[1][1][2]
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            pp sx
         
     | 
| 
      
 49 
     | 
    
         
            +
            exit
         
     | 
| 
      
 50 
     | 
    
         
            +
            File.open("last.o", "w") do |f|
         
     | 
| 
      
 51 
     | 
    
         
            +
                f << Marshal.dump(sx)
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
| 
      
 53 
     | 
    
         
            +
            # pp syd.sexp
         
     | 
    
        data/test/t3.rb
    ADDED
    
    
    
        data/test/t4.rb
    ADDED
    
    
    
        data/test/test.rb
    ADDED
    
    
    
        data/test/ubs.rb
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            \blah
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            rubygems_version: 0.8.11
         
     | 
| 
      
 3 
     | 
    
         
            +
            specification_version: 1
         
     | 
| 
      
 4 
     | 
    
         
            +
            name: sydparse
         
     | 
| 
      
 5 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 6 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
      
 7 
     | 
    
         
            +
            date: 2006-10-02 00:00:00 -07:00
         
     | 
| 
      
 8 
     | 
    
         
            +
            summary: A standalone ruby parser with sexp support.
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 11 
     | 
    
         
            +
            email: evan@fallingsnow.net
         
     | 
| 
      
 12 
     | 
    
         
            +
            homepage: 
         
     | 
| 
      
 13 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 16 
     | 
    
         
            +
            default_executable: ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 18 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 19 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
      
 20 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 21 
     | 
    
         
            +
              - - ">"
         
     | 
| 
      
 22 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 23 
     | 
    
         
            +
                  version: 0.0.0
         
     | 
| 
      
 24 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 25 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 26 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 27 
     | 
    
         
            +
            cert_chain: 
         
     | 
| 
      
 28 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 29 
     | 
    
         
            +
            - Evan Webb
         
     | 
| 
      
 30 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 31 
     | 
    
         
            +
            - env.h
         
     | 
| 
      
 32 
     | 
    
         
            +
            - extconf.rb
         
     | 
| 
      
 33 
     | 
    
         
            +
            - internal.h
         
     | 
| 
      
 34 
     | 
    
         
            +
            - lex.c.tab
         
     | 
| 
      
 35 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 36 
     | 
    
         
            +
            - bin/syd_pt_show
         
     | 
| 
      
 37 
     | 
    
         
            +
            - lib/sydparse
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib/sydparse.rb
         
     | 
| 
      
 39 
     | 
    
         
            +
            - Manifest.txt
         
     | 
| 
      
 40 
     | 
    
         
            +
            - node.h
         
     | 
| 
      
 41 
     | 
    
         
            +
            - parse_override.h
         
     | 
| 
      
 42 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 43 
     | 
    
         
            +
            - runtime.c
         
     | 
| 
      
 44 
     | 
    
         
            +
            - runtime.h
         
     | 
| 
      
 45 
     | 
    
         
            +
            - state.h
         
     | 
| 
      
 46 
     | 
    
         
            +
            - sydparse.c
         
     | 
| 
      
 47 
     | 
    
         
            +
            - sydparse.y
         
     | 
| 
      
 48 
     | 
    
         
            +
            - test
         
     | 
| 
      
 49 
     | 
    
         
            +
            - test/class.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - test/pt.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - test/show.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - test/t.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - test/t3.rb
         
     | 
| 
      
 54 
     | 
    
         
            +
            - test/t4.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - test/test.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - test/ubs.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 64 
     | 
    
         
            +
            - syd_pt_show
         
     | 
| 
      
 65 
     | 
    
         
            +
            extensions: 
         
     | 
| 
      
 66 
     | 
    
         
            +
            - extconf.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     |