lib/parser/ext/lexer.lex in fancy-0.5.0 vs lib/parser/ext/lexer.lex in fancy-0.6.0
- old
+ new
@@ -1,10 +1,10 @@
%{
#include "ruby.h"
#include "parser.h"
-int yyerror(char *s);
+int yyerror(VALUE self, char *s);
%}
%option yylineno
digit [0-9]
@@ -52,11 +52,11 @@
case "case"
identifier @?@?({lower}|[_&*])({letter}|{digit}|{special_under})*
selector ({letter}|[_&*])({letter}|{digit}|{special_under})*":"
constant {capital}({letter}|{digit}|{special_under})*
nested_constant ({constant}::)+{constant}
-symbol_lit \'({identifier}|{operator}|{constant}|:|"[]"|"|")+
+symbol_lit \'({identifier}|{operator}|{constant}|:|"[]"|"|"|".")+
ruby_send_open ({constant}|{identifier}){lparen}
ruby_oper_open {operator}{lparen}
regexp_lit "/".*"/"
comma ,
@@ -184,7 +184,12 @@
[ \t]* {}
{escaped_newline} {}
[\n] { return NL; }
-. { fprintf(stderr, "SCANNER %d", yyerror("")); exit(1); }
+. {
+ fprintf(stderr, "Invalid token: %s\n", yytext);
+ VALUE fancy = rb_const_get(rb_cObject, rb_intern("Fancy"));
+ VALUE parser = rb_const_get(fancy, rb_intern("Parser"));
+ yyerror(parser, yytext);
+}