Fixed lexer rule for literal naturals. Fixed reset_buffer (offset).
This commit is contained in:
parent
b361f71845
commit
669945d4f3
@ -53,10 +53,9 @@ let reset_line ~line buffer =
|
|||||||
|
|
||||||
let reset_offset ~offset buffer =
|
let reset_offset ~offset buffer =
|
||||||
assert (offset >= 0);
|
assert (offset >= 0);
|
||||||
Printf.printf "[reset] offset=%i\n" offset;
|
|
||||||
let open Lexing in
|
let open Lexing in
|
||||||
let bol = buffer.lex_curr_p.pos_bol in
|
let bol = buffer.lex_curr_p.pos_bol in
|
||||||
buffer.lex_curr_p <- {buffer.lex_curr_p with pos_cnum = bol (*+ offset*)}
|
buffer.lex_curr_p <- {buffer.lex_curr_p with pos_cnum = bol + offset }
|
||||||
|
|
||||||
let reset ?file ?line ?offset buffer =
|
let reset ?file ?line ?offset buffer =
|
||||||
let () =
|
let () =
|
||||||
@ -483,17 +482,17 @@ rule init state = parse
|
|||||||
| _ { rollback lexbuf; scan state lexbuf }
|
| _ { rollback lexbuf; scan state lexbuf }
|
||||||
|
|
||||||
and scan state = parse
|
and scan state = parse
|
||||||
nl { scan (push_newline state lexbuf) lexbuf }
|
nl { scan (push_newline state lexbuf) lexbuf }
|
||||||
| ' '+ { scan (push_space state lexbuf) lexbuf }
|
| ' '+ { scan (push_space state lexbuf) lexbuf }
|
||||||
| '\t'+ { scan (push_tabs state lexbuf) lexbuf }
|
| '\t'+ { scan (push_tabs state lexbuf) lexbuf }
|
||||||
|
|
||||||
| ident { mk_ident state lexbuf |> enqueue }
|
| ident { mk_ident state lexbuf |> enqueue }
|
||||||
| constr { mk_constr state lexbuf |> enqueue }
|
| constr { mk_constr state lexbuf |> enqueue }
|
||||||
| bytes { (mk_bytes seq) state lexbuf |> enqueue }
|
| bytes { (mk_bytes seq) state lexbuf |> enqueue }
|
||||||
| integer 'n' { mk_nat state lexbuf |> enqueue }
|
| natural 'n' { mk_nat state lexbuf |> enqueue }
|
||||||
| integer { mk_int state lexbuf |> enqueue }
|
| integer { mk_int state lexbuf |> enqueue }
|
||||||
| symbol { mk_sym state lexbuf |> enqueue }
|
| symbol { mk_sym state lexbuf |> enqueue }
|
||||||
| eof { mk_eof state lexbuf |> enqueue }
|
| eof { mk_eof state lexbuf |> enqueue }
|
||||||
|
|
||||||
| '"' { let opening, _, state = sync state lexbuf in
|
| '"' { let opening, _, state = sync state lexbuf in
|
||||||
let thread = {opening; len=1; acc=['"']} in
|
let thread = {opening; len=1; acc=['"']} in
|
||||||
@ -631,7 +630,7 @@ and scan_block thread state = parse
|
|||||||
and thread = push_string nl thread
|
and thread = push_string nl thread
|
||||||
in scan_block thread state lexbuf }
|
in scan_block thread state lexbuf }
|
||||||
| eof { fail thread.opening Unterminated_comment }
|
| eof { fail thread.opening Unterminated_comment }
|
||||||
| _ { let () = rollback lexbuf in
|
| _ { let () = rollback lexbuf in
|
||||||
let len = thread.len in
|
let len = thread.len in
|
||||||
let thread,
|
let thread,
|
||||||
status = scan_utf8 thread state lexbuf in
|
status = scan_utf8 thread state lexbuf in
|
||||||
|
@ -655,7 +655,7 @@ conditional:
|
|||||||
terminator = $5;
|
terminator = $5;
|
||||||
kwd_else = $6;
|
kwd_else = $6;
|
||||||
ifnot = $7}
|
ifnot = $7}
|
||||||
in {region; value}}
|
in {region; value} }
|
||||||
|
|
||||||
if_clause:
|
if_clause:
|
||||||
instruction {
|
instruction {
|
||||||
@ -668,7 +668,7 @@ if_clause:
|
|||||||
lbrace = $1;
|
lbrace = $1;
|
||||||
inside = (first, others), terminator;
|
inside = (first, others), terminator;
|
||||||
rbrace = closing} in
|
rbrace = closing} in
|
||||||
ClauseBlock {value; region}}
|
ClauseBlock {value; region} }
|
||||||
|
|
||||||
case_instr:
|
case_instr:
|
||||||
case(instruction) { $1 instr_to_region }
|
case(instruction) { $1 instr_to_region }
|
||||||
|
Loading…
Reference in New Issue
Block a user