Skip to content

Commit

Permalink
Merge PR #12570: CoqIDE: fix lexing of UTF-8 in quotations like const…
Browse files Browse the repository at this point in the history
…r:()

Reviewed-by: ppedrot
  • Loading branch information
ppedrot committed Jun 29, 2020
2 parents 1221b56 + a6571b3 commit c2b7696
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions ide/coqide/coq_lex.mll
Expand Up @@ -50,7 +50,10 @@ and comment = parse
| utf8_extra_byte { incr utf8_adjust; comment lexbuf }
| _ { comment lexbuf }

and quotation o c n l = parse | eof { raise Unterminated } | _ {
and quotation o c n l = parse
| eof { raise Unterminated }
| utf8_extra_byte { incr utf8_adjust; quotation o c n l lexbuf }
| _ {
let x = Lexing.lexeme lexbuf in
if x = o then quotation_nesting o c n l 1 lexbuf
else if x = c then
Expand All @@ -59,7 +62,10 @@ and quotation o c n l = parse | eof { raise Unterminated } | _ {
else quotation o c n l lexbuf
}

and quotation_nesting o c n l v = parse | eof { raise Unterminated } | _ {
and quotation_nesting o c n l v = parse
| eof { raise Unterminated }
| utf8_extra_byte { incr utf8_adjust; quotation o c n l lexbuf }
| _ {
let x = Lexing.lexeme lexbuf in
if x = o then
if n = v+1 then quotation o c n (l+1) lexbuf
Expand All @@ -68,7 +74,10 @@ and quotation_nesting o c n l v = parse | eof { raise Unterminated } | _ {
else quotation o c n l lexbuf
}

and quotation_closing o c n l v = parse | eof { raise Unterminated } | _ {
and quotation_closing o c n l v = parse
| eof { raise Unterminated }
| utf8_extra_byte { incr utf8_adjust; quotation o c n l lexbuf }
| _ {
let x = Lexing.lexeme lexbuf in
if x = c then
if n = v+1 then
Expand All @@ -79,7 +88,10 @@ and quotation_closing o c n l v = parse | eof { raise Unterminated } | _ {
else quotation o c n l lexbuf
}

and quotation_start o c n = parse | eof { raise Unterminated } | _ {
and quotation_start o c n = parse
| eof { raise Unterminated }
| utf8_extra_byte { incr utf8_adjust; quotation o c n 1 lexbuf }
| _ {
let x = Lexing.lexeme lexbuf in
if x = o then quotation_start o c (n+1) lexbuf
else quotation o c n 1 lexbuf
Expand Down

0 comments on commit c2b7696

Please sign in to comment.