summaryrefslogtreecommitdiff
path: root/src/webidl-lexer.l
diff options
context:
space:
mode:
authorVincent Sanders <vincent.sanders@collabora.co.uk>2012-09-07 16:51:43 +0100
committerVincent Sanders <vincent.sanders@collabora.co.uk>2012-09-07 16:51:43 +0100
commit7ba968e4c33d3a05ff9b23b8e593b400e34a4cad (patch)
treeeb22fdebb318eaa1d0df25a5e2d7518d73aab1e8 /src/webidl-lexer.l
parentf60d94623e676bb80670b465b1bed7ad4559581d (diff)
downloadnsgenbind-7ba968e4c33d3a05ff9b23b8e593b400e34a4cad.tar.gz
nsgenbind-7ba968e4c33d3a05ff9b23b8e593b400e34a4cad.tar.bz2
fixup error reporting to give linenumber
Diffstat (limited to 'src/webidl-lexer.l')
-rw-r--r--src/webidl-lexer.l29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/webidl-lexer.l b/src/webidl-lexer.l
index 0a0a5df..d240edc 100644
--- a/src/webidl-lexer.l
+++ b/src/webidl-lexer.l
@@ -1,5 +1,7 @@
+%{
+
/*
- * This is a unicode capable lexer for web IDL mostly derived from:
+ * This is a unicode capable lexer for web IDL derived from:
*
* W3C WEB IDL - http://www.w3.org/TR/WebIDL/ (especially the grammar
* in apendix A)
@@ -9,19 +11,6 @@
* section 7.2 for unicode value handling)
*/
-/* lexer options */
-%option never-interactive
-%option yylineno
-%option bison-bridge
-%option bison-locations
-%option nodefault
-%option warn
-%option prefix="webidl_"
-%option nounput
-
-/* header block */
-%{
-
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -34,6 +23,16 @@
%}
+
+/* lexer options */
+%option never-interactive
+%option yylineno
+%option bison-bridge
+%option bison-locations
+%option warn
+%option prefix="webidl_"
+%option nounput
+
/* regular definitions */
/* ecmascript section 7.2 defines whitespace http://ecma-international.org/ecma-262/5.1/#sec-7.2
@@ -100,7 +99,7 @@ poundsign ^{whitespace}*#
{whitespace} ++yylloc->last_column; /* skip whitespace */
-{lineend} if (yytext[0] == '\n') {
+{lineend} if (yytext[0] != '\r') {
/* update position counts */
++yylloc->last_line;
yylloc->last_column = 0;