Skip to content

Commit

Permalink
Improve access to stopped_at token with latest rkelly-remix.
Browse files Browse the repository at this point in the history
The latest RKelly Remix provides a hackless way to access this token.

Related to #415
  • Loading branch information
nene committed Jul 29, 2013
1 parent d311d9a commit 9bd4793
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jsduck.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.add_dependency 'rdiscount', '~> 2.1.6'
s.add_dependency 'json', '~> 1.8.0'
s.add_dependency 'parallel', '~> 0.7.1'
s.add_dependency 'rkelly-remix', '~> 0.0.2'
s.add_dependency 'rkelly-remix', '~> 0.0.3'
s.add_dependency 'dimensions', '~> 1.2.0'

s.add_development_dependency 'rspec'
Expand Down
7 changes: 2 additions & 5 deletions lib/jsduck/js/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ def parse
end

def syntax_error(parser)
tokens = parser.instance_variable_get(:@tokens)
position = parser.instance_variable_get(:@position)

if position < tokens.length
token = tokens[position-1]
token = parser.stopped_at
if token
"Invalid JavaScript syntax: Unexpected '#{token.value}' on line #{token.range.from.line}"
else
"Invalid JavaScript syntax: Unexpected end of file"
Expand Down

0 comments on commit 9bd4793

Please sign in to comment.