Class: Parser::Builders::Default

Inherits:
Object
  • Object
show all
Defined in:
opal/lib/opal/parser/patch.rb,
opal/lib/opal/parser/patch.rb

Direct Known Subclasses

Opal::AST::Builder

Instance Method Summary collapse

Instance Method Details

#check_lvar_name(name, loc) ⇒ Object



43
44
45
46
47
48
49
50
# File 'opal/lib/opal/parser/patch.rb', line 43

def check_lvar_name(name, loc)
  # https://javascript.info/regexp-unicode
  if name =~ `new RegExp('^[\\p{Ll}|_][\\p{L}\\p{Nl}\\p{Nd}_]*$', 'u')`
    # OK
  else
    diagnostic :error, :lvar_name, { name: name }, loc
  end
end

#string_value(token) ⇒ Object



83
84
85
# File 'opal/lib/opal/parser/patch.rb', line 83

def string_value(token)
  value(token)
end