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 val symbol_start : unit -> int
24
25
26 symbol_start and Parsing.symbol_end are to be called in the action part
27 of a grammar rule only. They return the offset of the string that
28 matches the left-hand side of the rule: symbol_start() returns the off‐
29 set of the first character; symbol_end() returns the offset after the
30 last character. The first character in a file is at offset 0.
31
32
33
34 val symbol_end : unit -> int
35
36 See Parsing.symbol_start .
37
38
39
40 val rhs_start : int -> int
41
42 Same as Parsing.symbol_start and Parsing.symbol_end , but return the
43 offset of the string matching the n th item on the right-hand side of
44 the rule, where n is the integer parameter to rhs_start and rhs_end .
45 n is 1 for the leftmost item.
46
47
48
49 val rhs_end : int -> int
50
51 See Parsing.rhs_start .
52
53
54
55 val symbol_start_pos : unit -> Lexing.position
56
57 Same as symbol_start , but return a position instead of an offset.
58
59
60
61 val symbol_end_pos : unit -> Lexing.position
62
63 Same as symbol_end , but return a position instead of an offset.
64
65
66
67 val rhs_start_pos : int -> Lexing.position
68
69 Same as rhs_start , but return a position instead of an offset.
70
71
72
73 val rhs_end_pos : int -> Lexing.position
74
75 Same as rhs_end , but return a position instead of an offset.
76
77
78
79 val clear_parser : unit -> unit
80
81 Empty the parser stack. Call it just after a parsing function has
82 returned, to remove all pointers from the parser stack to structures
83 that were built by semantic actions during parsing. This is optional,
84 but lowers the memory requirements of the programs.
85
86
87
88 exception Parse_error
89
90
91 Raised when a parser encounters a syntax error. Can also be raised
92 from the action part of a grammar rule, to initiate error recovery.
93
94
95
96 val set_trace : bool -> bool
97
98 Control debugging support for ocamlyacc -generated parsers. After
99 Parsing.set_trace true , the pushdown automaton that executes the
100 parsers prints a trace of its actions (reading a token, shifting a
101 state, reducing by a rule) on standard output. Parsing.set_trace false
102 turns this debugging trace off. The boolean returned is the previous
103 state of the trace flag.
104
105
106 Since 3.11.0
107
108
109
110
111
112OCamldoc 2018-07-14 Parsing(3)