summaryrefslogtreecommitdiff
path: root/sched/netlist_lexer.mll
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 14:41:21 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 14:41:21 +0100
commit25e1beee38cba662f62f2de85855091a4e718064 (patch)
tree2a0508e67b3dd673b65fb36c1746296fbcd9331b /sched/netlist_lexer.mll
parent40f46cd1ce93d7f8045dda4e0af91670cd681d57 (diff)
parent2595e3881e0904fc6ecb162775a149f5b0121848 (diff)
downloadSystDigit-Projet-25e1beee38cba662f62f2de85855091a4e718064.tar.gz
SystDigit-Projet-25e1beee38cba662f62f2de85855091a4e718064.zip
Merge branch 'jonathan' ; add unit tests.
Conflicts: cpu/alu.ml
Diffstat (limited to 'sched/netlist_lexer.mll')
-rw-r--r--sched/netlist_lexer.mll9
1 files changed, 8 insertions, 1 deletions
diff --git a/sched/netlist_lexer.mll b/sched/netlist_lexer.mll
index 60cb223..ec27367 100644
--- a/sched/netlist_lexer.mll
+++ b/sched/netlist_lexer.mll
@@ -1,5 +1,6 @@
{
open Netlist_parser
+open Lexing
exception Eof
let keyword_list =
@@ -22,10 +23,16 @@ let keyword_list =
"XOR", XOR;
]
+let newline lexbuf =
+ let pos = lexbuf.lex_curr_p in
+ lexbuf.lex_curr_p <-
+ { pos with pos_lnum = pos.pos_lnum + 1; pos_bol = pos.pos_cnum }
+
}
rule token = parse
- [' ' '\t' '\n'] { token lexbuf } (* skip blanks *)
+ | '\n' { newline lexbuf ; token lexbuf }
+ | [' ' '\t'] { token lexbuf } (* skip blanks *)
| "=" { EQUAL }
| ":" { COLON }
| "," { COMMA }