aboutsummaryrefslogtreecommitdiff
path: root/lib/qparser/lexbuf.mli
diff options
context:
space:
mode:
authorChimrod <>2023-10-28 16:47:23 +0200
committerChimrod <>2023-11-02 11:06:12 +0100
commitdd060261e35fcb8a57f03b01dbe84ab772a2a199 (patch)
tree8faf51bfe647ab844c976dfcbba4ad4d533f07b4 /lib/qparser/lexbuf.mli
parent872916a5661e31b655471ec0f9bf81a5474bc1ba (diff)
Set up a context for parsing the literal strings
Diffstat (limited to 'lib/qparser/lexbuf.mli')
-rw-r--r--lib/qparser/lexbuf.mli24
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/qparser/lexbuf.mli b/lib/qparser/lexbuf.mli
index 5fda8ff..dd13da4 100644
--- a/lib/qparser/lexbuf.mli
+++ b/lib/qparser/lexbuf.mli
@@ -43,12 +43,28 @@ val rollback : t -> unit
using a stack for determining the token to send.
*)
+type lexer = t -> Tokens.token
+type buffer_builder = Buffer.t -> lexer
+
+type stringWraper = {
+ start_string : lexer -> lexer;
+ (** Start a new string. This function is used insed the token lexer, in
+ order to identify how to start a new string *)
+ wrap : buffer_builder -> buffer_builder;
+ (** function used to escape the character and add it to the buffer. This
+ function is used inside the string lexer. *)
+ end_string : lexer;
+ (** Function used to match the end of the string. This function is used
+ after the string lexer, in order to identify the end patten for a
+ string *)
+}
+
type state =
- | Token (** Default state, parsing the tokens *)
- | String (** String enclosed by [''] *)
- | DString (** String enclosed by [""] *)
+ | Token of stringWraper (** Default state, parsing the tokens *)
+ | String of stringWraper (** String enclosed by [''] *)
| MString of int (** String enclosed by [{}]*)
- | EndString (** State raised just before closing the string *)
+ | EndString of stringWraper
+ (** State raised just before closing the string *)
| Expression (** Expression where [!] is an operator *)
val state : t -> state option