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