Skip to content

Commit

Permalink
Correctly lex unicode symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Ary Borenszweig committed Oct 13, 2014
1 parent a2f5494 commit c3d22c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/compiler/lexer/lexer_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe "Lexer" do
it_lexes_instance_var "@foo"
it_lexes_class_var "@@foo"
it_lexes_globals ["$foo", "$FOO", "$_foo", "$foo123"]
it_lexes_symbols [":foo", ":foo!", ":foo?", ":\"foo\""]
it_lexes_symbols [":foo", ":foo!", ":foo?", ":\"foo\"", ":かたな"]
it_lexes_global_match_data_index ["$1", "$10"]

it_lexes "$~", :"$~"
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/crystal/syntax/lexer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1935,11 +1935,11 @@ module Crystal
end

def ident_start?(char)
char.alpha? || char == '_'
char.alpha? || char == '_' || char.ord > 0x9F
end

def ident_part?(char)
ident_start?(char) || char.digit? || char.ord > 0x9F
ident_start?(char) || char.digit?
end

def ident_part_or_end?(char)
Expand Down

0 comments on commit c3d22c6

Please sign in to comment.