jruby-prism-parser 0.23.0.pre.SNAPSHOT-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +401 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +62 -0
- data/LICENSE.md +7 -0
- data/Makefile +101 -0
- data/README.md +98 -0
- data/config.yml +2902 -0
- data/docs/build_system.md +91 -0
- data/docs/configuration.md +64 -0
- data/docs/cruby_compilation.md +27 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +121 -0
- data/docs/fuzzing.md +88 -0
- data/docs/heredocs.md +36 -0
- data/docs/javascript.md +118 -0
- data/docs/local_variable_depth.md +229 -0
- data/docs/mapping.md +117 -0
- data/docs/parser_translation.md +34 -0
- data/docs/parsing_rules.md +19 -0
- data/docs/releasing.md +98 -0
- data/docs/ripper.md +36 -0
- data/docs/ruby_api.md +43 -0
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +209 -0
- data/docs/testing.md +55 -0
- data/ext/prism/api_node.c +5098 -0
- data/ext/prism/api_pack.c +267 -0
- data/ext/prism/extconf.rb +110 -0
- data/ext/prism/extension.c +1155 -0
- data/ext/prism/extension.h +18 -0
- data/include/prism/ast.h +5807 -0
- data/include/prism/defines.h +102 -0
- data/include/prism/diagnostic.h +339 -0
- data/include/prism/encoding.h +265 -0
- data/include/prism/node.h +57 -0
- data/include/prism/options.h +230 -0
- data/include/prism/pack.h +152 -0
- data/include/prism/parser.h +732 -0
- data/include/prism/prettyprint.h +26 -0
- data/include/prism/regexp.h +33 -0
- data/include/prism/util/pm_buffer.h +155 -0
- data/include/prism/util/pm_char.h +205 -0
- data/include/prism/util/pm_constant_pool.h +209 -0
- data/include/prism/util/pm_list.h +97 -0
- data/include/prism/util/pm_memchr.h +29 -0
- data/include/prism/util/pm_newline_list.h +93 -0
- data/include/prism/util/pm_state_stack.h +42 -0
- data/include/prism/util/pm_string.h +150 -0
- data/include/prism/util/pm_string_list.h +44 -0
- data/include/prism/util/pm_strncasecmp.h +32 -0
- data/include/prism/util/pm_strpbrk.h +46 -0
- data/include/prism/version.h +29 -0
- data/include/prism.h +289 -0
- data/jruby-prism.jar +0 -0
- data/lib/prism/compiler.rb +486 -0
- data/lib/prism/debug.rb +206 -0
- data/lib/prism/desugar_compiler.rb +207 -0
- data/lib/prism/dispatcher.rb +2150 -0
- data/lib/prism/dot_visitor.rb +4634 -0
- data/lib/prism/dsl.rb +785 -0
- data/lib/prism/ffi.rb +346 -0
- data/lib/prism/lex_compat.rb +908 -0
- data/lib/prism/mutation_compiler.rb +753 -0
- data/lib/prism/node.rb +17864 -0
- data/lib/prism/node_ext.rb +212 -0
- data/lib/prism/node_inspector.rb +68 -0
- data/lib/prism/pack.rb +224 -0
- data/lib/prism/parse_result/comments.rb +177 -0
- data/lib/prism/parse_result/newlines.rb +64 -0
- data/lib/prism/parse_result.rb +498 -0
- data/lib/prism/pattern.rb +250 -0
- data/lib/prism/serialize.rb +1354 -0
- data/lib/prism/translation/parser/compiler.rb +1838 -0
- data/lib/prism/translation/parser/lexer.rb +335 -0
- data/lib/prism/translation/parser/rubocop.rb +37 -0
- data/lib/prism/translation/parser.rb +178 -0
- data/lib/prism/translation/ripper.rb +577 -0
- data/lib/prism/translation/ruby_parser.rb +1521 -0
- data/lib/prism/translation.rb +11 -0
- data/lib/prism/version.rb +3 -0
- data/lib/prism/visitor.rb +495 -0
- data/lib/prism.rb +99 -0
- data/prism.gemspec +135 -0
- data/rbi/prism.rbi +7767 -0
- data/rbi/prism_static.rbi +207 -0
- data/sig/prism.rbs +4773 -0
- data/sig/prism_static.rbs +201 -0
- data/src/diagnostic.c +400 -0
- data/src/encoding.c +5132 -0
- data/src/node.c +2786 -0
- data/src/options.c +213 -0
- data/src/pack.c +493 -0
- data/src/prettyprint.c +8881 -0
- data/src/prism.c +18406 -0
- data/src/regexp.c +638 -0
- data/src/serialize.c +1554 -0
- data/src/token_type.c +700 -0
- data/src/util/pm_buffer.c +190 -0
- data/src/util/pm_char.c +318 -0
- data/src/util/pm_constant_pool.c +322 -0
- data/src/util/pm_list.c +49 -0
- data/src/util/pm_memchr.c +35 -0
- data/src/util/pm_newline_list.c +84 -0
- data/src/util/pm_state_stack.c +25 -0
- data/src/util/pm_string.c +203 -0
- data/src/util/pm_string_list.c +28 -0
- data/src/util/pm_strncasecmp.c +24 -0
- data/src/util/pm_strpbrk.c +180 -0
- metadata +156 -0
data/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
<h1 align="center">Prism Ruby parser</h1>
|
2
|
+
<div align="center">
|
3
|
+
<img alt="Prism Ruby parser" height="256px" src="https://github.com/ruby/prism/blob/main/doc/images/prism.png?raw=true">
|
4
|
+
</div>
|
5
|
+
|
6
|
+
This is a parser for the Ruby programming language. It is designed to be portable, error tolerant, and maintainable. It is written in C99 and has no dependencies. It is currently being integrated into [CRuby](https://github.com/ruby/ruby), [JRuby](https://github.com/jruby/jruby), [TruffleRuby](https://github.com/oracle/truffleruby), [Sorbet](https://github.com/sorbet/sorbet), and [Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree).
|
7
|
+
|
8
|
+
## Overview
|
9
|
+
|
10
|
+
The repository contains the infrastructure for both a shared library (libprism) and a native CRuby extension. The shared library has no bindings to CRuby itself, and so can be used by other projects. The native CRuby extension links against `ruby.h`, and so is suitable in the context of CRuby.
|
11
|
+
|
12
|
+
```
|
13
|
+
.
|
14
|
+
├── Makefile configuration to compile the shared library and native tests
|
15
|
+
├── Rakefile configuration to compile the native extension and run the Ruby tests
|
16
|
+
├── bin
|
17
|
+
│ ├── lex runs the lexer on a file or string, prints the tokens, and compares to ripper
|
18
|
+
│ └── parse runs the parser on a file or string and prints the syntax tree
|
19
|
+
├── config.yml specification for tokens and nodes in the tree
|
20
|
+
├── docs documentation about the project
|
21
|
+
├── ext
|
22
|
+
│ └── prism
|
23
|
+
│ ├── extconf.rb configuration to generate the Makefile for the native extension
|
24
|
+
│ └── extension.c the native extension that interacts with libprism
|
25
|
+
├── fuzz files related to fuzz testing
|
26
|
+
├── include
|
27
|
+
│ ├── prism header files for the shared library
|
28
|
+
│ └── prism.h main header file for the shared library
|
29
|
+
├── java Java bindings for the shared library
|
30
|
+
├── lib
|
31
|
+
│ ├── prism Ruby library files
|
32
|
+
│ └── prism.rb main entrypoint for the Ruby library
|
33
|
+
├── rakelib various Rake tasks for the project
|
34
|
+
├── rust
|
35
|
+
│ ├── ruby-prism Rustified crate for the shared library
|
36
|
+
│ └── ruby-prism-sys FFI binding for Rust
|
37
|
+
├── src
|
38
|
+
│ ├── enc various encoding files
|
39
|
+
│ ├── util various utility files
|
40
|
+
│ └── prism.c main entrypoint for the shared library
|
41
|
+
├── templates contains ERB templates generated by templates/template.rb
|
42
|
+
│ └── template.rb generates code from the nodes and tokens configured by config.yml
|
43
|
+
└── test
|
44
|
+
└── prism
|
45
|
+
├── fixtures Ruby code used for testing
|
46
|
+
└── snapshots snapshots of generated syntax trees corresponding to fixtures
|
47
|
+
```
|
48
|
+
|
49
|
+
## Getting started
|
50
|
+
|
51
|
+
To compile the shared library, you will need:
|
52
|
+
|
53
|
+
* C99 compiler
|
54
|
+
* make
|
55
|
+
* Ruby 2.7.0 or later
|
56
|
+
|
57
|
+
Once you have these dependencies, run:
|
58
|
+
|
59
|
+
```
|
60
|
+
bundle install
|
61
|
+
```
|
62
|
+
|
63
|
+
to fetch the Ruby dependencies. Finally, run:
|
64
|
+
|
65
|
+
```
|
66
|
+
bundle exec rake compile
|
67
|
+
```
|
68
|
+
|
69
|
+
to compile the shared library. It will be built in the `build` directory. To test that everything is working, run:
|
70
|
+
|
71
|
+
```
|
72
|
+
bin/parse -e "1 + 2"
|
73
|
+
```
|
74
|
+
|
75
|
+
to see the syntax tree for the expression `1 + 2`.
|
76
|
+
|
77
|
+
## Contributing
|
78
|
+
|
79
|
+
See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. We additionally have documentation about the overall design of the project as well as various subtopics.
|
80
|
+
|
81
|
+
* [Build system](docs/build_system.md)
|
82
|
+
* [Configuration](docs/configuration.md)
|
83
|
+
* [CRuby compilation](docs/cruby_compilation.md)
|
84
|
+
* [Design](docs/design.md)
|
85
|
+
* [Encoding](docs/encoding.md)
|
86
|
+
* [Fuzzing](docs/fuzzing.md)
|
87
|
+
* [Heredocs](docs/heredocs.md)
|
88
|
+
* [JavaScript](docs/javascript.md)
|
89
|
+
* [Local variable depth](docs/local_variable_depth.md)
|
90
|
+
* [Mapping](docs/mapping.md)
|
91
|
+
* [Parser translation](docs/parser_translation.md)
|
92
|
+
* [Parsing rules](docs/parsing_rules.md)
|
93
|
+
* [Releasing](docs/releasing.md)
|
94
|
+
* [Ripper](docs/ripper.md)
|
95
|
+
* [Ruby API](docs/ruby_api.md)
|
96
|
+
* [RubyParser translation](docs/ruby_parser_translation.md)
|
97
|
+
* [Serialization](docs/serialization.md)
|
98
|
+
* [Testing](docs/testing.md)
|