Commit da9a3d37 authored by gerd's avatar gerd

updating examples to newest programming style


git-svn-id: https://godirepo.camlcity.org/svn/lib-pxp/trunk@745 dbe99aee-44db-0310-b2b3-d33182c8eb97
parent 32dcf141
(* $Id *)
(* $Id$ *)
open Pxp_document
open Pxp_yacc
open Pxp_tree_parser
open Pxp_types
exception User_error of string
......@@ -125,7 +125,7 @@ let replace_macro_use container tree =
let read_macro_dtd config =
parse_dtd_entity config (from_file "macro.dtd")
Pxp_dtd_parser.parse_dtd_entity config (from_file "macro.dtd")
;;
......
......@@ -7,7 +7,7 @@
(* Examples for pull parsing *)
(**********************************************************************)
open Pxp_yacc
open Pxp_ev_parser
open Pxp_lexer_types
open Pxp_types
open Printf
......@@ -47,7 +47,7 @@ let parse_list s =
let rec parse_whole_list stream =
match stream with parser
[< 'E_start_tag("list",_,_);
[< 'E_start_tag("list",_,_,_);
l = parse_sub_list;
'E_end_tag("list",_);
'E_end_of_stream;
......@@ -56,19 +56,19 @@ let parse_list s =
and parse_sub_list stream =
match stream with parser
[< 'E_start_tag("cons",_,_);
[< 'E_start_tag("cons",_,_,_);
head = parse_object;
tail = parse_sub_list;
'E_end_tag("cons",_)
>] ->
head :: tail
| [< 'E_start_tag("nil",_,_); 'E_end_tag("nil",_) >] ->
| [< 'E_start_tag("nil",_,_,_); 'E_end_tag("nil",_) >] ->
[]
and parse_object stream =
match stream with parser
[< 'E_start_tag("int",_,_);
[< 'E_start_tag("int",_,_,_);
number = parse_text;
'E_end_tag("int",_)
>] ->
......@@ -92,8 +92,8 @@ let parse_list s =
let mgr = create_entity_manager config (from_string s) in
let next_event =
create_pull_parser config (`Entry_content[]) mgr in
let next_event_or_error n =
let e = next_event n in
let next_event_or_error _ =
let e = next_event () in
match e with
Some(E_error exn) -> raise exn
| _ -> e
......
......@@ -6,7 +6,7 @@
(* Read a record-list, delete a column, and print it as XML *)
open Pxp_types;;
open Pxp_document;;
open Pxp_yacc;;
open Pxp_tree_parser;;
let delcol col tree =
map_tree
......@@ -37,7 +37,8 @@ let main() =
exit 1
);
try
let dtd = parse_dtd_entity default_config (from_file "record.dtd") in
let dtd =
Pxp_dtd_parser.parse_dtd_entity default_config (from_file "record.dtd") in
let tree =
parse_content_entity default_config (from_channel stdin) dtd default_spec
in
......
......@@ -6,7 +6,7 @@
(* Read a record-list structure and print it *)
open Pxp_types;;
open Pxp_document;;
open Pxp_yacc;;
open Pxp_tree_parser;;
let print tree =
iter_tree
......@@ -33,7 +33,8 @@ let print tree =
let main() =
try
let dtd = parse_dtd_entity default_config (from_file "record.dtd") in
let dtd =
Pxp_dtd_parser.parse_dtd_entity default_config (from_file "record.dtd") in
let tree =
parse_content_entity default_config (from_channel stdin) dtd default_spec in
print tree
......
......@@ -6,7 +6,7 @@
(* Read a record-list, sort it, and print it as XML *)
open Pxp_types;;
open Pxp_document;;
open Pxp_yacc;;
open Pxp_tree_parser;;
let sort by tree =
map_tree
......@@ -48,7 +48,8 @@ let main() =
exit 1
);
try
let dtd = parse_dtd_entity default_config (from_file "record.dtd") in
let dtd =
Pxp_dtd_parser.parse_dtd_entity default_config (from_file "record.dtd") in
let tree =
parse_content_entity default_config (from_channel stdin) dtd default_spec
in
......
......@@ -26,8 +26,8 @@ releasebyte:
Makefile.config:
if ocamlfind query pxp-wlex-utf8 >/dev/null; then \
lexer="pxp-lex-iso88591 pxp-wlex-utf8"; \
if ocamlfind query pxp-ulex-utf8 >/dev/null; then \
lexer="pxp-lex-iso88591 pxp-ulex-utf8"; \
else \
lexer="pxp-lex-iso88591 pxp-lex-utf8"; \
fi; \
......
......@@ -5,7 +5,7 @@
open Pxp_document;;
open Pxp_yacc;;
open Pxp_tree_parser;;
open Pxp_types;;
let error_happened = ref false;;
......
......@@ -27,7 +27,7 @@
* (conversion of <?xml-stylesheet ...?> to <style ...>)
*)
open Pxp_yacc;;
open Pxp_tree_parser;;
open Pxp_types;;
open Pxp_document;;
......
......@@ -6,7 +6,7 @@
open Tk
open Pxp_types
open Pxp_document
open Pxp_yacc
open Pxp_tree_parser
open Ds_context
open Ds_style
......@@ -44,7 +44,7 @@ let edit filename cmd =
root # extension # prepare (index :> 'ext index);
let obj_dtd =
parse_dtd_entity
Pxp_dtd_parser.parse_dtd_entity
default_config
(from_file object_dtd_sysid)
in
......
......@@ -5,7 +5,7 @@
open Pxp_types
open Pxp_document
open Pxp_yacc
open Pxp_tree_parser
let empty_record = new element_impl (Pxp_yacc.default_extension);;
let empty_dnode = new data_impl Pxp_yacc.default_extension;;
......
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