382 >> (fn (((tok, pos'), tags), source) => |
382 >> (fn (((tok, pos'), tags), source) => |
383 let val name = Token.content_of tok |
383 let val name = Token.content_of tok |
384 in (SOME (name, pos', tags), (mk (name, source), (flag, d))) end)); |
384 in (SOME (name, pos', tags), (mk (name, source), (flag, d))) end)); |
385 |
385 |
386 val command = Scan.peek (fn d => |
386 val command = Scan.peek (fn d => |
387 Parse.position (Scan.one (Token.is_command)) -- |
387 Scan.optional (Scan.one Token.is_private -- improper >> op ::) [] -- |
388 Scan.repeat tag |
388 Scan.one Token.is_command -- Scan.repeat tag |
389 >> (fn ((tok, pos), tags) => |
389 >> (fn ((private, cmd), tags) => |
390 let val name = Token.content_of tok |
390 map (fn tok => (NONE, (Basic_Token tok, ("", d)))) private @ |
391 in (SOME (name, pos, tags), (Basic_Token tok, (Latex.markup_false, d))) end)); |
391 [(SOME (Token.content_of cmd, Token.pos_of cmd, tags), |
|
392 (Basic_Token cmd, (Latex.markup_false, d)))])); |
392 |
393 |
393 val cmt = Scan.peek (fn d => |
394 val cmt = Scan.peek (fn d => |
394 Parse.$$$ "--" |-- Parse.!!!! (improper |-- Parse.document_source) >> |
395 Parse.$$$ "--" |-- Parse.!!!! (improper |-- Parse.document_source) >> |
395 (fn source => (NONE, (Markup_Token ("cmt", source), ("", d))))); |
396 (fn source => (NONE, (Markup_Token ("cmt", source), ("", d))))); |
396 |
397 |
397 val other = Scan.peek (fn d => |
398 val other = Scan.peek (fn d => |
398 Parse.not_eof >> (fn tok => (NONE, (Basic_Token tok, ("", d))))); |
399 Parse.not_eof >> (fn tok => (NONE, (Basic_Token tok, ("", d))))); |
399 |
400 |
400 val token = |
401 val tokens = |
401 ignored || |
402 (ignored || |
402 markup Keyword.is_document_heading Markup_Token Latex.markup_true || |
403 markup Keyword.is_document_heading Markup_Token Latex.markup_true || |
403 markup Keyword.is_document_body Markup_Env_Token Latex.markup_true || |
404 markup Keyword.is_document_body Markup_Env_Token Latex.markup_true || |
404 markup Keyword.is_document_raw (Verbatim_Token o #2) "" || |
405 markup Keyword.is_document_raw (Verbatim_Token o #2) "") >> single || |
405 command || cmt || other; |
406 command || |
|
407 (cmt || other) >> single; |
406 |
408 |
407 |
409 |
408 (* spans *) |
410 (* spans *) |
409 |
411 |
410 val is_eof = fn (_, (Basic_Token x, _)) => Token.is_eof x | _ => false; |
412 val is_eof = fn (_, (Basic_Token x, _)) => Token.is_eof x | _ => false; |