Change to NigelThorne fork to detect infinite loops
and fixed grammar to ignore missing parameter list.
This commit is contained in:
parent
f60bbfa9ca
commit
20433e3ad2
5
Gemfile
5
Gemfile
@ -1,8 +1,11 @@
|
|||||||
source "http://rubygems.org"
|
source "http://rubygems.org"
|
||||||
|
|
||||||
gem "parslet" , "~> 1.6.1"
|
gem "parslet" , :git => 'https://github.com/NigelThorne/parslet.git'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "minitest"
|
gem "minitest"
|
||||||
gem "simplecov"
|
gem "simplecov"
|
||||||
|
gem "jeweler"
|
||||||
|
gem "roodi"
|
||||||
|
gem 'pry'
|
||||||
end
|
end
|
||||||
|
73
Gemfile.lock
73
Gemfile.lock
@ -1,22 +1,89 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/NigelThorne/parslet.git
|
||||||
|
revision: be698466bfa21a35d838fc7d3cd741b8aa1977b0
|
||||||
|
specs:
|
||||||
|
parslet (1.7.0)
|
||||||
|
blankslate (~> 2.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
addressable (2.3.6)
|
||||||
blankslate (2.1.2.4)
|
blankslate (2.1.2.4)
|
||||||
|
builder (3.2.2)
|
||||||
|
coderay (1.1.0)
|
||||||
|
descendants_tracker (0.0.4)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
docile (1.1.3)
|
docile (1.1.3)
|
||||||
|
faraday (0.9.0)
|
||||||
|
multipart-post (>= 1.2, < 3)
|
||||||
|
git (1.2.6)
|
||||||
|
github_api (0.11.3)
|
||||||
|
addressable (~> 2.3)
|
||||||
|
descendants_tracker (~> 0.0.1)
|
||||||
|
faraday (~> 0.8, < 0.10)
|
||||||
|
hashie (>= 1.2)
|
||||||
|
multi_json (>= 1.7.5, < 2.0)
|
||||||
|
nokogiri (~> 1.6.0)
|
||||||
|
oauth2
|
||||||
|
hashie (2.1.1)
|
||||||
|
highline (1.6.21)
|
||||||
|
jeweler (2.0.1)
|
||||||
|
builder
|
||||||
|
bundler (>= 1.0)
|
||||||
|
git (>= 1.2.5)
|
||||||
|
github_api
|
||||||
|
highline (>= 1.6.15)
|
||||||
|
nokogiri (>= 1.5.10)
|
||||||
|
rake
|
||||||
|
rdoc
|
||||||
|
json (1.8.1)
|
||||||
|
jwt (1.0.0)
|
||||||
|
method_source (0.8.2)
|
||||||
|
mini_portile (0.6.0)
|
||||||
minitest (5.3.2)
|
minitest (5.3.2)
|
||||||
multi_json (1.9.2)
|
multi_json (1.9.2)
|
||||||
parslet (1.6.1)
|
multi_xml (0.5.5)
|
||||||
blankslate (~> 2.0)
|
multipart-post (2.0.0)
|
||||||
|
nokogiri (1.6.2.1)
|
||||||
|
mini_portile (= 0.6.0)
|
||||||
|
nokogiri (1.6.2.1-x64-mingw32)
|
||||||
|
mini_portile (= 0.6.0)
|
||||||
|
oauth2 (0.9.4)
|
||||||
|
faraday (>= 0.8, < 0.10)
|
||||||
|
jwt (~> 1.0)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
multi_xml (~> 0.5)
|
||||||
|
rack (~> 1.2)
|
||||||
|
pry (0.9.12.6)
|
||||||
|
coderay (~> 1.0)
|
||||||
|
method_source (~> 0.8)
|
||||||
|
slop (~> 3.4)
|
||||||
|
rack (1.5.2)
|
||||||
|
rake (10.3.2)
|
||||||
|
rdoc (4.1.1)
|
||||||
|
json (~> 1.4)
|
||||||
|
roodi (4.0.0)
|
||||||
|
ruby_parser (~> 3.2, >= 3.2.2)
|
||||||
|
ruby_parser (3.6.1)
|
||||||
|
sexp_processor (~> 4.1)
|
||||||
|
sexp_processor (4.4.3)
|
||||||
simplecov (0.8.2)
|
simplecov (0.8.2)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
multi_json
|
multi_json
|
||||||
simplecov-html (~> 0.8.0)
|
simplecov-html (~> 0.8.0)
|
||||||
simplecov-html (0.8.0)
|
simplecov-html (0.8.0)
|
||||||
|
slop (3.5.0)
|
||||||
|
thread_safe (0.3.4)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
x64-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
jeweler
|
||||||
minitest
|
minitest
|
||||||
parslet (~> 1.6.1)
|
parslet!
|
||||||
|
pry
|
||||||
|
roodi
|
||||||
simplecov
|
simplecov
|
||||||
|
@ -31,6 +31,7 @@ module Parser
|
|||||||
include Operators
|
include Operators
|
||||||
include ModuleDef
|
include ModuleDef
|
||||||
|
|
||||||
rule(:root){ (module_definition | class_definition | function_definition | expression | call_site ).repeat }
|
rule(:root_body) {(module_definition | class_definition | function_definition | expression | call_site )}
|
||||||
|
rule(:root) { root_body.repeat() }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ module Parser
|
|||||||
|
|
||||||
rule(:function_definition) {
|
rule(:function_definition) {
|
||||||
keyword_def >> ((module_name|instance_variable|name).as(:receiver) >> str(".")).maybe >> #possibly qualified
|
keyword_def >> ((module_name|instance_variable|name).as(:receiver) >> str(".")).maybe >> #possibly qualified
|
||||||
name.as(:function_name) >> parmeter_list >> newline >> expressions_end >> newline
|
name.as(:function_name) >> parmeter_list.maybe >> newline >> expressions_end >> newline
|
||||||
}
|
}
|
||||||
|
|
||||||
rule(:parmeter_list) {
|
rule(:parmeter_list) {
|
||||||
|
@ -3,12 +3,12 @@ module Parser
|
|||||||
include Parslet
|
include Parslet
|
||||||
rule(:module_definition) do
|
rule(:module_definition) do
|
||||||
keyword_module >> module_name >> eol >>
|
keyword_module >> module_name >> eol >>
|
||||||
( (keyword_end.absent? >> root).repeat(1)).as(:module_expressions) >> keyword_end >> newline
|
( (keyword_end.absent? >> root_body).repeat()).as(:module_expressions) >> keyword_end >> newline
|
||||||
end
|
end
|
||||||
|
|
||||||
rule(:class_definition) do
|
rule(:class_definition) do
|
||||||
keyword_class >> module_name >> eol >>
|
keyword_class >> module_name >> eol >>
|
||||||
( (keyword_end.absent? >> root).repeat(1)).as(:class_expressions) >> keyword_end >> newline
|
( (keyword_end.absent? >> root_body).repeat()).as(:class_expressions) >> keyword_end >> newline
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user