Commit 92d8800b authored by Pietro Abate's avatar Pietro Abate

[r2004-05-23 08:40:41 by afrisch] Empty log message

Original author: afrisch
Date: 2004-05-23 08:40:41+00:00
parent 29a527bc
......@@ -8,6 +8,7 @@ else
PACKAGES += pxp-lex-utf8
endif
SYNTAX = -I misc/ q_symbol.cmo \
-symbol cduce_version=\"$(VERSION)\" \
-symbol build_date=\"$(shell date +%Y-%m-%d)\" \
......
......@@ -8,9 +8,11 @@ let mkTelbook (l : [Person*]) : [<entry>[Name Tel] *] =
transform l with <person>[ (n & Name) (t & Tel) ; _ ] -> [ <entry>[n t] ]
match argv with
match argv [] with
| [ f ] ->
(match load_xml f with
| <addrbook>(x & [Person*]) -> mkTelbook x
| <addrbook>(x & [Person*]) ->
let x = <addrbook>(mkTelbook x) in
print (print_xml x)
| _ -> raise "Invalid document")
| _ -> raise "Invalid command line"
......@@ -220,42 +220,18 @@ driver/librarian.cmx: types/builtin.cmx compile/compile.cmx \
misc/encodings.cmx runtime/eval.cmx types/ident.cmx compile/lambda.cmx \
parser/location.cmx parser/parser.cmx misc/serialize.cmx typing/typer.cmx \
types/types.cmx runtime/value.cmx driver/librarian.cmi
cdo2cmo/ml_types.cmo: types/types.cmi
cdo2cmo/ml_types.cmx: types/types.cmx
cdo2cmo/ml_cduce.cmo: types/atoms.cmi types/builtin_defs.cmi types/chars.cmi \
compile/compile.cmi misc/encodings.cmi types/ident.cmo \
types/intervals.cmi compile/lambda.cmo driver/librarian.cmi \
cdo2cmo/ml_types.cmo misc/ns.cmi types/sequence.cmi typing/typer.cmi \
types/types.cmi
cdo2cmo/ml_cduce.cmx: types/atoms.cmx types/builtin_defs.cmx types/chars.cmx \
compile/compile.cmx misc/encodings.cmx types/ident.cmx \
types/intervals.cmx compile/lambda.cmx driver/librarian.cmx \
cdo2cmo/ml_types.cmx misc/ns.cmx types/sequence.cmx typing/typer.cmx \
types/types.cmx
cdo2cmo/ml_ocaml.cmo: driver/librarian.cmi cdo2cmo/ml_types.cmo
cdo2cmo/ml_ocaml.cmx: driver/librarian.cmx cdo2cmo/ml_types.cmx
cdo2cmo/ml_checker.cmo: cdo2cmo/ml_cduce.cmo cdo2cmo/ml_ocaml.cmo \
cdo2cmo/ml_types.cmo
cdo2cmo/ml_checker.cmx: cdo2cmo/ml_cduce.cmx cdo2cmo/ml_ocaml.cmx \
cdo2cmo/ml_types.cmx
cdo2cmo/ml_generator.cmo: cdo2cmo/ml_cduce.cmo cdo2cmo/ml_ocaml.cmo \
cdo2cmo/ml_types.cmo
cdo2cmo/ml_generator.cmx: cdo2cmo/ml_cduce.cmx cdo2cmo/ml_ocaml.cmx \
cdo2cmo/ml_types.cmx
driver/cduce.cmo: parser/ast.cmo types/builtin.cmi compile/compile.cmi \
misc/encodings.cmi runtime/eval.cmi runtime/explain.cmi types/ident.cmo \
driver/librarian.cmi parser/location.cmi cdo2cmo/ml_cduce.cmo \
cdo2cmo/ml_checker.cmo cdo2cmo/ml_generator.cmo cdo2cmo/ml_ocaml.cmo \
misc/ns.cmi parser/parser.cmi types/patterns.cmi types/sample.cmi \
schema/schema_common.cmi misc/state.cmi typing/typer.cmi types/types.cmi \
parser/ulexer.cmi runtime/value.cmi driver/cduce.cmi
driver/librarian.cmi parser/location.cmi misc/ns.cmi parser/parser.cmi \
types/patterns.cmi types/sample.cmi schema/schema_common.cmi \
misc/state.cmi typing/typer.cmi types/types.cmi parser/ulexer.cmi \
runtime/value.cmi driver/cduce.cmi
driver/cduce.cmx: parser/ast.cmx types/builtin.cmx compile/compile.cmx \
misc/encodings.cmx runtime/eval.cmx runtime/explain.cmx types/ident.cmx \
driver/librarian.cmx parser/location.cmx cdo2cmo/ml_cduce.cmx \
cdo2cmo/ml_checker.cmx cdo2cmo/ml_generator.cmx cdo2cmo/ml_ocaml.cmx \
misc/ns.cmx parser/parser.cmx types/patterns.cmx types/sample.cmx \
schema/schema_common.cmx misc/state.cmx typing/typer.cmx types/types.cmx \
parser/ulexer.cmx runtime/value.cmx driver/cduce.cmi
driver/librarian.cmx parser/location.cmx misc/ns.cmx parser/parser.cmx \
types/patterns.cmx types/sample.cmx schema/schema_common.cmx \
misc/state.cmx typing/typer.cmx types/types.cmx parser/ulexer.cmx \
runtime/value.cmx driver/cduce.cmi
query/query.cmo: parser/ast.cmo types/atoms.cmi types/builtin_defs.cmi \
types/chars.cmi types/ident.cmo types/intervals.cmi parser/location.cmi \
parser/parser.cmi types/types.cmi query/query.cmi
......
......@@ -60,29 +60,30 @@ let elem (tag_ns,tag) att child =
class warner = object method warn w = print_endline ("PXP WARNING: " ^ w) end
*)
type token =
| Element of Value.t
| Start of Ns.qname * (Ns.qname * Utf8.t) list * Ns.table
| String of string
type stack =
| Element of Value.t * stack
| Start of Ns.qname * (Ns.qname * Utf8.t) list * Ns.table * stack
| String of string * stack
| Empty
let stack = ref []
let stack = ref Empty
let ns_table = ref Ns.empty_table
let rec create_elt accu = function
| String s :: st -> create_elt (string s accu) st
| Element x :: st -> create_elt (Pair (x,accu)) st
| Start (name,att,table) :: st ->
stack := Element (elem name att accu) :: st;
| String (s,st) -> create_elt (string s accu) st
| Element (x,st) -> create_elt (Pair (x,accu)) st
| Start (name,att,table,st) ->
stack := Element (elem name att accu, st);
ns_table := table
| [] -> assert false
| Empty -> assert false
let start_element_handler name att =
if not (only_ws txt.buffer txt.pos) then
stack := String (String.sub txt.buffer 0 txt.pos) :: !stack;
stack := String (String.sub txt.buffer 0 txt.pos, !stack);
txt.pos <- 0;
let (table,name,att) = Ns.process_start_tag !ns_table name att in
stack := Start (name,att,!ns_table) :: !stack;
stack := Start (name,att,!ns_table, !stack);
ns_table := table
let end_element_handler _ =
......@@ -178,9 +179,9 @@ let load_xml s =
| `Expat -> load_expat s
| `Pxp -> load_pxp (Url.process s));
match !stack with
| [ Element x ] -> stack := []; x
| Element (x,Empty) -> stack := Empty; x
| _ -> assert false
with e -> stack := []; txt.pos <-0; raise e
with e -> stack := Empty; txt.pos <-0; raise e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment