1Parsing(3) OCaml library Parsing(3)
2
3
4
6 Parsing - The run-time library for parsers generated by ocamlyacc.
7
9 Module Parsing
10
12 Module Parsing
13 : sig end
14
15
16 The run-time library for parsers generated by ocamlyacc .
17
18
19
20
21
22
23
24 val symbol_start : unit -> int
25
26
27 symbol_start and Parsing.symbol_end are to be called in the action part
28 of a grammar rule only. They return the offset of the string that
29 matches the left-hand side of the rule: symbol_start() returns the off‐
30 set of the first character; symbol_end() returns the offset after the
31 last character. The first character in a file is at offset 0.
32
33
34
35
36 val symbol_end : unit -> int
37
38 See Parsing.symbol_start .
39
40
41
42
43 val rhs_start : int -> int
44
45 Same as Parsing.symbol_start and Parsing.symbol_end , but return the
46 offset of the string matching the n th item on the right-hand side of
47 the rule, where n is the integer parameter to rhs_start and rhs_end .
48 n is 1 for the leftmost item.
49
50
51
52
53 val rhs_end : int -> int
54
55 See Parsing.rhs_start .
56
57
58
59
60 val symbol_start_pos : unit -> Lexing.position
61
62 Same as symbol_start , but return a position instead of an offset.
63
64
65
66
67 val symbol_end_pos : unit -> Lexing.position
68
69 Same as symbol_end , but return a position instead of an offset.
70
71
72
73
74 val rhs_start_pos : int -> Lexing.position
75
76 Same as rhs_start , but return a position instead of an offset.
77
78
79
80
81 val rhs_end_pos : int -> Lexing.position
82
83 Same as rhs_end , but return a position instead of an offset.
84
85
86
87
88 val clear_parser : unit -> unit
89
90 Empty the parser stack. Call it just after a parsing function has
91 returned, to remove all pointers from the parser stack to structures
92 that were built by semantic actions during parsing. This is optional,
93 but lowers the memory requirements of the programs.
94
95
96
97
98 exception Parse_error
99
100
101 Raised when a parser encounters a syntax error. Can also be raised
102 from the action part of a grammar rule, to initiate error recovery.
103
104
105
106
107
108
109OCamldoc 2007-05-24 Parsing(3)