]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/bin/roles/rolesLexer.mll
372446fc72aded6c875a47909825b76b62d7740c
[helm.git] / matita / matita / contribs / lambdadelta / bin / roles / rolesLexer.mll
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic
3     ||A||  Library of Mathematics, developed at the Computer Science
4     ||T||  Department, University of Bologna, Italy.
5     ||I||
6     ||T||  HELM is free software; you can redistribute it and/or
7     ||A||  modify it under the terms of the GNU General Public License
8     \   /  version 2 or (at your option) any later version.
9      \ /   This software is distributed as is, NO WARRANTY.
10       V_______________________________________________________________ *)
11
12 {
13   module EG = RolesGlobal
14   module EP = RolesParser
15
16   let out s = if !EG.debug_lexer then prerr_endline s
17 }
18
19 let SPC  = ['\r' '\n' '\t' ' ']+
20 let QT   = "\""
21 let TEXT = ['0'-'9' 'A'-'Z' 'a'-'z' '/' '.' '_']+
22
23 rule token = parse
24   | SPC          { token lexbuf           }
25   | QT           { let s = text lexbuf in 
26                    out s; EP.TEXT s       }
27   | ":"          { out ":"; EP.SC         }
28   | "("          { out "("; EP.OP         }
29   | ")"          { out ")"; EP.CP         }
30   | "ver"   as s { out s; EP.VER          } 
31   | "old"   as s { out s; EP.OLD          }
32   | "new"   as s { out s; EP.NEW          }
33   | "rel"   as s { out s; EP.REL          }
34   | "base"  as s { out s; EP.BASE         }
35   | "top"   as s { out s; EP.TOP          }
36   | "roles" as s { out s; EP.ROLES        }
37   | eof          { EP.EOF                 }
38
39 and text = parse
40    | QT          { ""                     }
41    | TEXT   as s { s ^ text lexbuf        }