File: xmlstate.ml

package info (click to toggle)
mlglade 0.9-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 480 kB
  • ctags: 370
  • sloc: ml: 4,693; makefile: 154; sh: 4
file content (36 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(*
 * $Id: xmlstate.ml,v 1.1 2002/03/05 14:23:03 monate Exp $

    Copyright (c) 1999 Christian Lindig <lindig@ips.cs.tu-bs.de>. All
    rights reserved. See COPYING for details.
 * 
 * Scanning XML files is context dependend. The parser controlls
 * the context of the scanner.
 *)


type context =      | ElementContext 
                    | DataContext
                    | DeclContext
                    | PiContext

(* [contextAsString] is only for debuging.
 *)

let contextAsString = function
    | ElementContext    -> "element"
    | DataContext       -> "pc"
    | DeclContext       -> "xml"
    | PiContext         -> "pi"

(* [context] holds the current scanning context used 
 * by parser and scanner. Don't access directy.
 *)
let context	    = ref DataContext

(* get and set context *)
 
let setContext c    = context := c (* ; print_endline (contextAsString c) *)
let getContext ()   = !context