ast_utils 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/README.md +3 -0
- data/ast_utils.gemspec +1 -1
- data/exe/ast_utils +4 -0
- data/lib/ast_utils/cli.rb +1 -1
- data/lib/ast_utils/version.rb +1 -1
- data/lib/ast_utils.rb +0 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8840d3eb5e7151059ca38ed971ea7c07b083123c
|
4
|
+
data.tar.gz: 9b900680e8eaf48e832b951cfcf95721a815be8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfe1bc0be475e270d5fda5dcd3ebbd0764afe56d6a084aca7fd3d1520d26ff450815c5f7c5535aa3209de6d2500d6ad4517bacb26f2cb42aa876044c1738514e
|
7
|
+
data.tar.gz: f4b5a629c841623b06764f0d50f78bdd106d55dc30839db36cb2318bed271ab787cd8e8a3376c0455feb35730ca674dfde196e23e91057606948abfec64ea2fd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -28,6 +28,7 @@ In Ruby, local variable scope can be nested, and identification on local variabl
|
|
28
28
|
This utility give labels to identify local variables.
|
29
29
|
|
30
30
|
```rb
|
31
|
+
require "parser/current"
|
31
32
|
require "ast_utils"
|
32
33
|
|
33
34
|
node = Parser::CurrentRuby.parse(source)
|
@@ -39,6 +40,7 @@ labeled = ASTUtils::Labeling.translate(node: node)
|
|
39
40
|
`AST` has `children` but no pointer to its parent.
|
40
41
|
|
41
42
|
```rb
|
43
|
+
require "parser/current"
|
42
44
|
require "ast_utils"
|
43
45
|
|
44
46
|
node = Parser::CurrentRuby.parse(source)
|
@@ -54,6 +56,7 @@ parent = navigation.parent(child_node)
|
|
54
56
|
It associates outer scope and its inner scope.
|
55
57
|
|
56
58
|
```rb
|
59
|
+
require "parser/current"
|
57
60
|
require "ast_utils"
|
58
61
|
|
59
62
|
node = Parser::CurrentRuby.parse(source)
|
data/ast_utils.gemspec
CHANGED
data/exe/ast_utils
CHANGED
data/lib/ast_utils/cli.rb
CHANGED
@@ -6,7 +6,7 @@ module ASTUtils
|
|
6
6
|
def label(*scripts)
|
7
7
|
scripts.map {|script| Pathname(script) }.each do |path|
|
8
8
|
puts "Parsing #{path}..."
|
9
|
-
node = Parser::
|
9
|
+
node = Parser::Ruby25.parse(path.read, path.to_s)
|
10
10
|
puts "Translating node..."
|
11
11
|
labeled = Labeling.translate(node: node)
|
12
12
|
puts "#{labeled.inspect}"
|
data/lib/ast_utils/version.rb
CHANGED
data/lib/ast_utils.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "ast_utils/version"
|
2
2
|
|
3
|
-
require "parser/current"
|
4
3
|
require "pathname"
|
5
4
|
require "set"
|
6
5
|
|
@@ -10,6 +9,3 @@ require "ast_utils/partial_map"
|
|
10
9
|
require "ast_utils/labeling"
|
11
10
|
require "ast_utils/navigation"
|
12
11
|
require "ast_utils/scope"
|
13
|
-
|
14
|
-
Parser::Builders::Default.emit_lambda = true
|
15
|
-
Parser::Builders::Default.emit_procarg0 = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ast_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.19
|
75
|
+
version: '0.19'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.19
|
82
|
+
version: '0.19'
|
83
83
|
description: Ruby AST Utility
|
84
84
|
email:
|
85
85
|
- matsumoto@soutaro.com
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.6.
|
128
|
+
rubygems_version: 2.6.13
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Ruby AST Utility
|