syntax_tree 2.0.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +13 -6
- data/Gemfile.lock +1 -1
- data/README.md +2 -6
- data/lib/syntax_tree/cli.rb +0 -11
- data/lib/syntax_tree/node.rb +3 -477
- data/lib/syntax_tree/version.rb +1 -1
- data/lib/syntax_tree.rb +11 -0
- metadata +2 -2
data/lib/syntax_tree/version.rb
CHANGED
data/lib/syntax_tree.rb
CHANGED
@@ -25,6 +25,17 @@ unless PrettyPrint.const_defined?(:Align)
|
|
25
25
|
end
|
26
26
|
|
27
27
|
module SyntaxTree
|
28
|
+
# This holds references to objects that respond to both #parse and #format
|
29
|
+
# so that we can use them in the CLI.
|
30
|
+
HANDLERS = {}
|
31
|
+
HANDLERS.default = SyntaxTree
|
32
|
+
|
33
|
+
# This is a hook provided so that plugins can register themselves as the
|
34
|
+
# handler for a particular file type.
|
35
|
+
def self.register_handler(extension, handler)
|
36
|
+
HANDLERS[extension] = handler
|
37
|
+
end
|
38
|
+
|
28
39
|
# Parses the given source and returns the syntax tree.
|
29
40
|
def self.parse(source)
|
30
41
|
parser = Parser.new(source)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syntax_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
124
|
+
rubygems_version: 3.4.0.dev
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A parser based on ripper
|