We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test case:
require 'parser/ruby30' if RUBY_ENGINE == 'opal' require 'corelib/string/unpack' # https://github.com/opal/opal/blob/master/lib/opal/parser/patch.rb class Parser::Source::Buffer def source_lines @lines ||= begin lines = @source.lines.to_a lines << '' if @source.end_with?("\n") lines.map { |line| line.chomp("\n") } end end end # https://github.com/whitequark/parser/issues/784 module Parser class Diagnostic undef :render_line def render_line(range, ellipsis=false, range_end=false) source_line = range.source_line highlight_line = [' '] * source_line.length @highlights.each do |highlight| line_range = range.source_buffer.line_range(range.line) if highlight = highlight.intersect(line_range) highlight_line[highlight.column_range] = ['~'] * highlight.size end end if range.is?("\n") highlight_line << "^" else if !range_end && range.size >= 1 highlight_line[range.column_range] = ['^'] + ['~'] * (range.size - 1) else highlight_line[range.column_range] = ['~'] * range.size end end highlight_line += %w(. . .) if ellipsis highlight_line = highlight_line.join [source_line, highlight_line]. map { |line| "#{range.source_buffer.name}:#{range.line}: #{line}" } end end end end p Parser::Ruby30.parse('1 => a')
The issue is a regular expression using POSIX bracket expressions: https://github.com/whitequark/parser/blob/21684f12eb73ac416fa88ecee7198739a1847596/lib/parser/builders/default.rb#L1726-L1732
Patch:
module Parser class Builders::Default def check_lvar_name(name, loc) if name =~ /^[_a-z][_\w]*$/ # OK else diagnostic :error, :lvar_name, { name: name }, loc end end end end
The text was updated successfully, but these errors were encountered:
Parser::Builder::Default.check_lvar_name patch
ab16575
See opal/opal#2195
An alternative regex:
/^\p{Ll}(\p{L}|\p{N}|_)*$/u
Seems to be nearly universally supported these days
Sorry, something went wrong.
Proposed here: https://github.com/opal/opal/pull/2243/files#diff-5e29ec5ef4397f3b4d0a4d402fa6b59b22a295cafabd9e22aefb8c95fa92c2a5R42-R50
Successfully merging a pull request may close this issue.
Test case:
The issue is a regular expression using POSIX bracket expressions: https://github.com/whitequark/parser/blob/21684f12eb73ac416fa88ecee7198739a1847596/lib/parser/builders/default.rb#L1726-L1732
Patch:
The text was updated successfully, but these errors were encountered: