fixed but with single char identifiers

This commit is contained in:
Tobias Lutke
2012-10-30 21:41:56 -04:00
parent 82c222ef0f
commit 2f6b67798e
3 changed files with 3 additions and 2 deletions

View File

@@ -561,7 +561,7 @@ YY_RULE(int) yy_rangelet(yycontext *ctx)
}
YY_RULE(int) yy_identifier(yycontext *ctx)
{ int yypos0= ctx->pos, yythunkpos0= ctx->thunkpos;
yyprintf((stderr, "%s\n", "identifier")); if (!yymatchClass(ctx, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l15; if (!yymatchClass(ctx, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l15;
yyprintf((stderr, "%s\n", "identifier")); if (!yymatchClass(ctx, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l15;
l16:;
{ int yypos17= ctx->pos, yythunkpos17= ctx->thunkpos; if (!yymatchClass(ctx, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l17; goto l16;
l17:; ctx->pos= yypos17; ctx->thunkpos= yythunkpos17;

View File

@@ -78,7 +78,7 @@ const = "true" { $$ = Qtrue; }
;
digit = [0-9];
identifier = [a-zA-Z][a-zA-Z0-9_\-]+[?!]?;
identifier = [a-zA-Z][a-zA-Z0-9_\-]*[?!]?;
%%

View File

@@ -42,6 +42,7 @@ class ParserTest < Test::Unit::TestCase
def test_lookups
assert_equal [[:id, "variable"], [:lookup, nil]], Parser.parse('variable')
assert_equal [[:id, "underscored_variable"], [:lookup, nil]], Parser.parse('underscored_variable')
assert_equal [[:id, "c"], [:lookup, nil]], Parser.parse('c')
end
def test_global_hash