Skip to content

Commit

Permalink
allow underscores and dashes in identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
smtlaissezfaire committed Jun 6, 2011
1 parent 1b0cca2 commit 18f483e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/loop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ def run_with_printing(cmd)

run(code).should == "10"
end

it "should allow dashes in identifiers" do
run("(define foo-bar 10) (print foo-bar)").should == "10"
end

it "should allow underscores in identifiers" do
run("(define foo_bar 10) (print foo_bar)").should == "10"
end
end

describe "scoping variables" do
Expand Down
2 changes: 1 addition & 1 deletion src/scanner.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Token *scan(string str) {
period = ".";
float = [0-9]* period [0-9]+;
string = "\"" ([^"])* "\"";
symbol = [a-z?]+;
symbol = [a-z\?\-\_]+;
boolean_true = "#t";
boolean_false = "#f";
open_paren = "(";
Expand Down

0 comments on commit 18f483e

Please sign in to comment.