functor BurgLexFun(structure Tokens : Burg_TOKENS)= struct structure UserDeclarations = struct (* burg-lex * * COPYRIGHT (c) 1995 AT&T Bell Laboratories. * * ML-Lex specification for ML-burg. *) structure T = Tokens structure E = ErrorMsg type pos = int type svalue = T.svalue type ('a,'b) token = ('a,'b) T.token type lexresult = (svalue,pos) token val comLevel = ref 0 val lineNum = ref 0 val verbatimLevel = ref 0 val percentCount = ref 0 val rawLine = ref "" val rawNoNewLine = ref false val raw:string list ref = ref [] val reachedEop = ref false fun resetState() = (comLevel := 0; lineNum := 0; verbatimLevel := 0; percentCount := 0; rawLine := ""; rawNoNewLine := false; raw := []; reachedEop := false) fun inc (ri as ref i) = (ri := i+1) fun dec (ri as ref i) = (ri := i-1) fun incVerbLvl() = if !verbatimLevel <> 0 then E.impossible "nested verbatim levels" else inc verbatimLevel fun outputRaw (s:string) = (rawLine := !rawLine^s; rawNoNewLine := true) fun rawNextLine () = (raw := !rawLine^"\n":: (!raw); rawLine := ""; rawNoNewLine := false) fun rawStop () = if !rawNoNewLine then rawNextLine () else () fun eof() = (if !comLevel > 0 then E.complain "unclosed comment" else if !verbatimLevel <> 0 then E.complain "unclosed user input" else (); if !reachedEop then T.K_EOF(!lineNum,!lineNum) else (rawStop (); T.PPERCENT(rev(!raw),!lineNum,!lineNum) before (raw := []; reachedEop := true))) end (* end of user routines *) exception LexError (* raised if illegal leaf action tried *) structure Internal = struct datatype yyfinstate = N of int type statedata = {fin : yyfinstate list, trans: string} (* transition & final state table *) val tab = let val s = [ (0, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (1, "\000\000\000\000\000\000\000\000\000\049\050\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\049\000\000\000\000\019\000\000\017\016\000\000\015\000\000\000\ \\014\014\014\014\014\014\014\014\014\014\013\012\000\011\000\000\ \\000\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\ \\010\010\010\010\010\010\010\010\010\010\010\000\000\000\000\000\ \\000\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\ \\010\010\010\010\010\010\010\010\010\010\010\000\009\000\000\000\ \\000" ), (3, "\051\051\051\051\051\051\051\051\051\051\056\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\054\051\052\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\ \\051" ), (5, "\057\057\057\057\057\057\057\057\057\057\060\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\058\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057" ), (7, "\061\061\061\061\061\061\061\061\061\061\062\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061" ), (10, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\010\010\010\010\010\010\010\010\010\010\000\000\000\000\000\000\ \\000\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\ \\010\010\010\010\010\010\010\010\010\010\010\000\000\000\000\010\ \\000\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\ \\010\010\010\010\010\010\010\010\010\010\010\000\000\000\000\000\ \\000" ), (14, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\014\014\014\014\014\014\014\014\014\014\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (17, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\018\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (19, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\048\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\038\031\021\000\000\000\000\000\000\020\000\000\000\000\ \\000" ), (21, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (22, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\023\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (23, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\024\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (24, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\025\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (25, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\026\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (26, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\027\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (27, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\028\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (28, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\029\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (29, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\030\000\000\000\000\000\000\000\ \\000" ), (31, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000\ \\000\000\000\000\032\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (32, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\033\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (33, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\034\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (34, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\035\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (36, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\037\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (38, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\039\000\000\000\000\000\000\000\000\000\000\ \\000" ), (39, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (40, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\041\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (41, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\042\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (42, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\043\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (43, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\044\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (44, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\045\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (45, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\046\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (46, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\047\000\000\000\000\000\000\000\ \\000" ), (49, "\000\000\000\000\000\000\000\000\000\049\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\049\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (52, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\053\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (54, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\055\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \\000" ), (57, "\057\057\057\057\057\057\057\057\057\057\000\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057" ), (58, "\057\057\057\057\057\057\057\057\057\057\000\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\057\ \\057\057\057\057\057\057\057\057\057\057\057\057\057\059\057\057\ \\057" ), (61, "\061\061\061\061\061\061\061\061\061\061\000\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\ \\061" ), (0, "")] fun f x = x val s = map f (rev (tl (rev s))) exception LexHackingError fun look ((j,x)::r, i) = if i = j then x else look(r, i) | look ([], i) = raise LexHackingError fun g {fin=x, trans=i} = {fin=x, trans=look(s,i)} in Vector.fromList(map g [{fin = [], trans = 0}, {fin = [(N 9)], trans = 1}, {fin = [(N 9)], trans = 1}, {fin = [], trans = 3}, {fin = [], trans = 3}, {fin = [(N 93)], trans = 5}, {fin = [(N 93)], trans = 5}, {fin = [(N 97)], trans = 7}, {fin = [(N 97)], trans = 7}, {fin = [(N 25)], trans = 0}, {fin = [(N 76)], trans = 10}, {fin = [(N 23)], trans = 0}, {fin = [(N 21)], trans = 0}, {fin = [(N 19)], trans = 0}, {fin = [(N 73)], trans = 14}, {fin = [(N 17)], trans = 0}, {fin = [(N 15)], trans = 0}, {fin = [(N 13)], trans = 17}, {fin = [(N 70)], trans = 0}, {fin = [], trans = 19}, {fin = [(N 4)], trans = 0}, {fin = [], trans = 21}, {fin = [], trans = 22}, {fin = [], trans = 23}, {fin = [(N 31)], trans = 24}, {fin = [], trans = 25}, {fin = [], trans = 26}, {fin = [], trans = 27}, {fin = [], trans = 28}, {fin = [], trans = 29}, {fin = [(N 50)], trans = 0}, {fin = [], trans = 31}, {fin = [], trans = 32}, {fin = [], trans = 33}, {fin = [], trans = 34}, {fin = [(N 38)], trans = 0}, {fin = [], trans = 36}, {fin = [(N 67)], trans = 0}, {fin = [], trans = 38}, {fin = [], trans = 39}, {fin = [], trans = 40}, {fin = [], trans = 41}, {fin = [], trans = 42}, {fin = [], trans = 43}, {fin = [], trans = 44}, {fin = [], trans = 45}, {fin = [], trans = 46}, {fin = [(N 62)], trans = 0}, {fin = [(N 7)], trans = 0}, {fin = [(N 9)], trans = 49}, {fin = [(N 1),(N 11)], trans = 0}, {fin = [(N 86)], trans = 0}, {fin = [(N 86)], trans = 52}, {fin = [(N 84)], trans = 0}, {fin = [(N 86)], trans = 54}, {fin = [(N 79)], trans = 0}, {fin = [(N 81)], trans = 0}, {fin = [(N 93)], trans = 57}, {fin = [(N 93)], trans = 58}, {fin = [(N 89),(N 93)], trans = 57}, {fin = [(N 91)], trans = 0}, {fin = [(N 97)], trans = 61}, {fin = [(N 95)], trans = 0}]) end structure StartStates = struct datatype yystartstate = STARTSTATE of int (* start state definitions *) val COMMENT = STARTSTATE 3; val DUMP = STARTSTATE 5; val INITIAL = STARTSTATE 1; val POSTLUDE = STARTSTATE 7; end type result = UserDeclarations.lexresult exception LexerError (* raised if illegal leaf action tried *) end fun makeLexer yyinput = let val yygone0=1 val yyb = ref "\n" (* buffer *) val yybl = ref 1 (*buffer length *) val yybufpos = ref 1 (* location of next character to use *) val yygone = ref yygone0 (* position in file of beginning of buffer *) val yydone = ref false (* eof found yet? *) val yybegin = ref 1 (*Current 'start state' for lexer *) val YYBEGIN = fn (Internal.StartStates.STARTSTATE x) => yybegin := x fun lex () : Internal.result = let fun continue() = lex() in let fun scan (s,AcceptingLeaves : Internal.yyfinstate list list,l,i0) = let fun action (i,nil) = raise LexError | action (i,nil::l) = action (i-1,l) | action (i,(node::acts)::l) = case node of Internal.N yyk => (let fun yymktext() = substring(!yyb,i0,i-i0) val yypos = i0+ !yygone open UserDeclarations Internal.StartStates in (yybufpos := i; case yyk of (* Application actions *) 1 => (inc lineNum; continue()) | 11 => (inc lineNum; continue()) | 13 => (T.K_LPAREN(!lineNum,!lineNum)) | 15 => (T.K_RPAREN(!lineNum,!lineNum)) | 17 => (T.K_COMMA(!lineNum,!lineNum)) | 19 => (T.K_COLON(!lineNum,!lineNum)) | 21 => (T.K_SEMICOLON(!lineNum,!lineNum)) | 23 => (T.K_EQUAL(!lineNum,!lineNum)) | 25 => (T.K_PIPE(!lineNum,!lineNum)) | 31 => (T.K_TERM(!lineNum,!lineNum)) | 38 => (T.K_START(!lineNum,!lineNum)) | 4 => (incVerbLvl(); YYBEGIN DUMP; continue()) | 50 => (T.K_TERMPREFIX(!lineNum,!lineNum)) | 62 => (T.K_RULEPREFIX(!lineNum,!lineNum)) | 67 => (T.K_SIG(!lineNum,!lineNum)) | 7 => (inc percentCount; if !percentCount = 2 then (YYBEGIN POSTLUDE; continue()) else T.PPERCENT(rev(!raw),!lineNum,!lineNum) before raw := []) | 70 => (YYBEGIN COMMENT; comLevel:=1; continue()) | 73 => let val yytext=yymktext() in T.INT(valOf(Int.fromString yytext),!lineNum,!lineNum) end | 76 => let val yytext=yymktext() in T.ID(yytext,!lineNum,!lineNum) end | 79 => (inc comLevel; continue()) | 81 => (inc lineNum; continue()) | 84 => (dec comLevel; if !comLevel=0 then YYBEGIN INITIAL else (); continue()) | 86 => (continue()) | 89 => (rawStop(); dec verbatimLevel; YYBEGIN INITIAL; continue()) | 9 => (continue()) | 91 => (rawNextLine (); inc lineNum; continue()) | 93 => let val yytext=yymktext() in outputRaw yytext; continue() end | 95 => (rawNextLine (); inc lineNum; continue()) | 97 => let val yytext=yymktext() in outputRaw yytext; continue() end | _ => raise Internal.LexerError ) end ) val {fin,trans} = Unsafe.Vector.sub(Internal.tab, s) val NewAcceptingLeaves = fin::AcceptingLeaves in if l = !yybl then if trans = #trans(Vector.sub(Internal.tab,0)) then action(l,NewAcceptingLeaves ) else let val newchars= if !yydone then "" else yyinput 1024 in if (size newchars)=0 then (yydone := true; if (l=i0) then UserDeclarations.eof () else action(l,NewAcceptingLeaves)) else (if i0=l then yyb := newchars else yyb := substring(!yyb,i0,l-i0)^newchars; yygone := !yygone+i0; yybl := size (!yyb); scan (s,AcceptingLeaves,l-i0,0)) end else let val NewChar = Char.ord(Unsafe.CharVector.sub(!yyb,l)) val NewChar = if NewChar<128 then NewChar else 128 val NewState = Char.ord(Unsafe.CharVector.sub(trans,NewChar)) in if NewState=0 then action(l,NewAcceptingLeaves) else scan(NewState,NewAcceptingLeaves,l+1,i0) end end (* val start= if substring(!yyb,!yybufpos-1,1)="\n" then !yybegin+1 else !yybegin *) in scan(!yybegin (* start *),nil,!yybufpos,!yybufpos) end end in lex end end
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: se !yybegin *) in scan(!yybegin (* start *),nil,!yybufpos,!yybufpos) end end in lex end end