Merge branch 'rinderknecht@fix-verbatim' into 'dev'
Improved the lexing of verbatim strings for Michelson inclusion See merge request ligolang/ligo!713
This commit is contained in:
commit
0b0de1ea59
@ -516,11 +516,22 @@ and scan_string thread state = parse
|
|||||||
scan_string (thread#push_char c) state lexbuf }
|
scan_string (thread#push_char c) state lexbuf }
|
||||||
|
|
||||||
and scan_verbatim thread state = parse
|
and scan_verbatim thread state = parse
|
||||||
| eof { fail thread#opening Unterminated_verbatim}
|
nl as nl { let () = Lexing.new_line lexbuf
|
||||||
| "|}" { let _, _, state = state#sync lexbuf
|
and state = state#set_pos (state#pos#new_line nl)
|
||||||
in thread, state }
|
in scan_verbatim (thread#push_string nl) state lexbuf }
|
||||||
| _ as c { let _, _, state = state#sync lexbuf in
|
| '#' blank* (natural as line) blank+ '"' (string as file) '"' {
|
||||||
scan_verbatim (thread#push_char c) state lexbuf }
|
let _, _, state = state#sync lexbuf in
|
||||||
|
let flags, state = scan_flags state [] lexbuf in
|
||||||
|
let () = ignore flags in
|
||||||
|
let line = int_of_string line
|
||||||
|
and file = Filename.basename file in
|
||||||
|
let pos = state#pos#set ~file ~line ~offset:0 in
|
||||||
|
let state = state#set_pos pos in
|
||||||
|
scan_verbatim thread state lexbuf }
|
||||||
|
| eof { fail thread#opening Unterminated_verbatim }
|
||||||
|
| "|}" { let _, _, state = state#sync lexbuf in thread, state }
|
||||||
|
| _ as c { let _, _, state = state#sync lexbuf in
|
||||||
|
scan_verbatim (thread#push_char c) state lexbuf }
|
||||||
|
|
||||||
(* Finishing a block comment
|
(* Finishing a block comment
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user