let regexp qstring = '"' [^ '"']* '"'
let regexp begincomment = "(**" xml_blank
+let regexp beginnote = "(*"
let regexp endcomment = "*)"
-let regexp comment_char = [^'*'] | '*'[^')']
-let regexp note = "(*" ([^'*'] | "**") comment_char* "*)"
+(* let regexp comment_char = [^'*'] | '*'[^')']
+let regexp note = "|+" ([^'*'] | "**") comment_char* "+|" *)
let level1_layouts =
[ "sub"; "sup";
remove_left_quote (Ulexing.utf8_lexeme lexbuf))
| eof -> return_eoi lexbuf
+let rec comment_token acc depth =
+ lexer
+ | beginnote ->
+ let acc = acc ^ Ulexing.utf8_lexeme lexbuf in
+ comment_token acc (depth + 1) lexbuf
+ | endcomment ->
+ let acc = acc ^ Ulexing.utf8_lexeme lexbuf in
+ if depth = 0
+ then acc
+ else comment_token acc (depth - 1) lexbuf
+ | _ ->
+ let acc = acc ^ Ulexing.utf8_lexeme lexbuf in
+ comment_token acc depth lexbuf
+
(** @param k continuation to be invoked when no ligature has been found *)
let rec ligatures_token k =
lexer
return lexbuf ("UNPARSED_META",
remove_left_quote (Ulexing.utf8_lexeme lexbuf))
| meta_anonymous -> return lexbuf ("UNPARSED_META", "anonymous")
- | note ->
- let comment =
+ | beginnote ->
+ let comment = comment_token (Ulexing.utf8_lexeme lexbuf) 0 lexbuf in
+(* let comment =
Ulexing.utf8_sub_lexeme lexbuf 2 (Ulexing.lexeme_length lexbuf - 4)
in
- return lexbuf ("NOTE", comment)
+ return lexbuf ("NOTE", comment) *)
+ ligatures_token level2_ast_token lexbuf
| begincomment -> return lexbuf ("BEGINCOMMENT","")
| endcomment -> return lexbuf ("ENDCOMMENT","")
| eof -> return_eoi lexbuf