Shortened the parser's API.
Unfortunately, even thought all the front-ends use the same ParserAPI.ml, that file cannot be moved to the folder `shared` due to a dependency on AST.ml produced by Menhir.
This commit is contained in:
parent
548b1267a4
commit
379311a748
@ -1,98 +1,64 @@
|
|||||||
(** Generic parser for LIGO *)
|
(** Generic parser for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
(* Errors *)
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
||||||
|
let reg = region#to_string ~file ~offsets mode in
|
||||||
type token
|
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
(* Main functor *)
|
||||||
|
|
||||||
exception Error
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
|
(Parser: module type of Parser)
|
||||||
(* The monolithic API *)
|
(ParErr: sig val message : int -> string end) =
|
||||||
|
struct
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
type message = string
|
||||||
|
type valid = Lexer.token
|
||||||
(* The incremental API *)
|
type invalid = Lexer.token
|
||||||
|
|
||||||
module MenhirInterpreter :
|
exception Point of message * valid option * invalid
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
module I = Parser.MenhirInterpreter
|
||||||
with type token = token
|
module S = MenhirLib.General (* Streams *)
|
||||||
end
|
|
||||||
|
(* The call [stack checkpoint] extracts the parser's stack out of
|
||||||
module Incremental :
|
a checkpoint. *)
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
let stack = function
|
||||||
end
|
I.HandlingError env -> I.stack env
|
||||||
end
|
| _ -> assert false
|
||||||
|
|
||||||
(* Errors *)
|
(* The call [state checkpoint] extracts the number of the current
|
||||||
|
state out of a parser checkpoint. *)
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
let state checkpoint : int =
|
||||||
val message : int -> string (* From error states to messages *)
|
match Lazy.force (stack checkpoint) with
|
||||||
end
|
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
||||||
|
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
||||||
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
|
||||||
let reg = region#to_string ~file ~offsets mode in
|
(* The parser has successfully produced a semantic value. *)
|
||||||
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
|
||||||
|
let success v = v
|
||||||
(* Main functor *)
|
|
||||||
|
(* The parser has suspended itself because of a syntax error. Stop. *)
|
||||||
module Make (Lexer: Lexer.S)
|
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
let failure get_win checkpoint =
|
||||||
(ParErr: PAR_ERR) =
|
let message = ParErr.message (state checkpoint) in
|
||||||
struct
|
match get_win () with
|
||||||
type message = string
|
Lexer.Nil -> assert false
|
||||||
type valid = Lexer.token
|
| Lexer.One invalid ->
|
||||||
type invalid = Lexer.token
|
raise (Point (message, None, invalid))
|
||||||
|
| Lexer.Two (invalid, valid) ->
|
||||||
exception Point of message * valid option * invalid
|
raise (Point (message, Some valid, invalid))
|
||||||
|
|
||||||
module I = Parser.MenhirInterpreter
|
(* The generic parsing function *)
|
||||||
module S = MenhirLib.General (* Streams *)
|
|
||||||
|
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
||||||
(* The call [stack checkpoint] extracts the parser's stack out of
|
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
||||||
a checkpoint. *)
|
and failure = failure get_win in
|
||||||
|
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
||||||
let stack = function
|
let ast = I.loop_handle success failure supplier parser
|
||||||
I.HandlingError env -> I.stack env
|
in close (); ast
|
||||||
| _ -> assert false
|
|
||||||
|
let mono_contract = Parser.contract
|
||||||
(* The call [state checkpoint] extracts the number of the current
|
end
|
||||||
state out of a parser checkpoint. *)
|
|
||||||
|
|
||||||
let state checkpoint : int =
|
|
||||||
match Lazy.force (stack checkpoint) with
|
|
||||||
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
|
||||||
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
|
||||||
|
|
||||||
(* The parser has successfully produced a semantic value. *)
|
|
||||||
|
|
||||||
let success v = v
|
|
||||||
|
|
||||||
(* The parser has suspended itself because of a syntax error. Stop. *)
|
|
||||||
|
|
||||||
let failure get_win checkpoint =
|
|
||||||
let message = ParErr.message (state checkpoint) in
|
|
||||||
match get_win () with
|
|
||||||
Lexer.Nil -> assert false
|
|
||||||
| Lexer.One invalid ->
|
|
||||||
raise (Point (message, None, invalid))
|
|
||||||
| Lexer.Two (invalid, valid) ->
|
|
||||||
raise (Point (message, Some valid, invalid))
|
|
||||||
|
|
||||||
(* The generic parsing function *)
|
|
||||||
|
|
||||||
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
|
||||||
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
|
||||||
and failure = failure get_win in
|
|
||||||
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
|
||||||
let ast = I.loop_handle success failure supplier parser
|
|
||||||
in close (); ast
|
|
||||||
|
|
||||||
let mono_contract = Parser.contract
|
|
||||||
|
|
||||||
end
|
|
||||||
|
@ -1,50 +1,16 @@
|
|||||||
(** Generic parser API for LIGO *)
|
(** Generic parser API for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
|
||||||
|
|
||||||
type token
|
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
|
||||||
|
|
||||||
exception Error
|
|
||||||
|
|
||||||
(* The monolithic API *)
|
|
||||||
|
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
|
||||||
|
|
||||||
(* The incremental API *)
|
|
||||||
|
|
||||||
module MenhirInterpreter :
|
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
|
||||||
with type token = token
|
|
||||||
end
|
|
||||||
|
|
||||||
module Incremental :
|
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
(* Errors *)
|
(* Errors *)
|
||||||
|
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
|
||||||
val message : int -> string (* From error states to messages *)
|
|
||||||
end
|
|
||||||
|
|
||||||
val format_error :
|
val format_error :
|
||||||
?offsets:bool -> [`Byte | `Point] ->
|
?offsets:bool -> [`Byte | `Point] ->
|
||||||
string Region.reg -> file:bool -> string
|
string Region.reg -> file:bool -> string
|
||||||
|
|
||||||
(* Main functor *)
|
(* Main functor *)
|
||||||
|
|
||||||
module Make (Lexer: Lexer.S)
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
(Parser: module type of Parser)
|
||||||
(ParErr: PAR_ERR) :
|
(ParErr: sig val message: int -> string end) :
|
||||||
sig
|
sig
|
||||||
type message = string
|
type message = string
|
||||||
type valid = Lexer.token
|
type valid = Lexer.token
|
||||||
|
@ -1,98 +1,64 @@
|
|||||||
(** Generic parser for LIGO *)
|
(** Generic parser for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
(* Errors *)
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
||||||
|
let reg = region#to_string ~file ~offsets mode in
|
||||||
type token
|
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
(* Main functor *)
|
||||||
|
|
||||||
exception Error
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
|
(Parser: module type of Parser)
|
||||||
(* The monolithic API *)
|
(ParErr: sig val message : int -> string end) =
|
||||||
|
struct
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
type message = string
|
||||||
|
type valid = Lexer.token
|
||||||
(* The incremental API *)
|
type invalid = Lexer.token
|
||||||
|
|
||||||
module MenhirInterpreter :
|
exception Point of message * valid option * invalid
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
module I = Parser.MenhirInterpreter
|
||||||
with type token = token
|
module S = MenhirLib.General (* Streams *)
|
||||||
end
|
|
||||||
|
(* The call [stack checkpoint] extracts the parser's stack out of
|
||||||
module Incremental :
|
a checkpoint. *)
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
let stack = function
|
||||||
end
|
I.HandlingError env -> I.stack env
|
||||||
end
|
| _ -> assert false
|
||||||
|
|
||||||
(* Errors *)
|
(* The call [state checkpoint] extracts the number of the current
|
||||||
|
state out of a parser checkpoint. *)
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
let state checkpoint : int =
|
||||||
val message : int -> string (* From error states to messages *)
|
match Lazy.force (stack checkpoint) with
|
||||||
end
|
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
||||||
|
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
||||||
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
|
||||||
let reg = region#to_string ~file ~offsets mode in
|
(* The parser has successfully produced a semantic value. *)
|
||||||
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
|
||||||
|
let success v = v
|
||||||
(* Main functor *)
|
|
||||||
|
(* The parser has suspended itself because of a syntax error. Stop. *)
|
||||||
module Make (Lexer: Lexer.S)
|
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
let failure get_win checkpoint =
|
||||||
(ParErr: PAR_ERR) =
|
let message = ParErr.message (state checkpoint) in
|
||||||
struct
|
match get_win () with
|
||||||
type message = string
|
Lexer.Nil -> assert false
|
||||||
type valid = Lexer.token
|
| Lexer.One invalid ->
|
||||||
type invalid = Lexer.token
|
raise (Point (message, None, invalid))
|
||||||
|
| Lexer.Two (invalid, valid) ->
|
||||||
exception Point of message * valid option * invalid
|
raise (Point (message, Some valid, invalid))
|
||||||
|
|
||||||
module I = Parser.MenhirInterpreter
|
(* The generic parsing function *)
|
||||||
module S = MenhirLib.General (* Streams *)
|
|
||||||
|
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
||||||
(* The call [stack checkpoint] extracts the parser's stack out of
|
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
||||||
a checkpoint. *)
|
and failure = failure get_win in
|
||||||
|
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
||||||
let stack = function
|
let ast = I.loop_handle success failure supplier parser
|
||||||
I.HandlingError env -> I.stack env
|
in close (); ast
|
||||||
| _ -> assert false
|
|
||||||
|
let mono_contract = Parser.contract
|
||||||
(* The call [state checkpoint] extracts the number of the current
|
end
|
||||||
state out of a parser checkpoint. *)
|
|
||||||
|
|
||||||
let state checkpoint : int =
|
|
||||||
match Lazy.force (stack checkpoint) with
|
|
||||||
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
|
||||||
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
|
||||||
|
|
||||||
(* The parser has successfully produced a semantic value. *)
|
|
||||||
|
|
||||||
let success v = v
|
|
||||||
|
|
||||||
(* The parser has suspended itself because of a syntax error. Stop. *)
|
|
||||||
|
|
||||||
let failure get_win checkpoint =
|
|
||||||
let message = ParErr.message (state checkpoint) in
|
|
||||||
match get_win () with
|
|
||||||
Lexer.Nil -> assert false
|
|
||||||
| Lexer.One invalid ->
|
|
||||||
raise (Point (message, None, invalid))
|
|
||||||
| Lexer.Two (invalid, valid) ->
|
|
||||||
raise (Point (message, Some valid, invalid))
|
|
||||||
|
|
||||||
(* The generic parsing function *)
|
|
||||||
|
|
||||||
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
|
||||||
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
|
||||||
and failure = failure get_win in
|
|
||||||
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
|
||||||
let ast = I.loop_handle success failure supplier parser
|
|
||||||
in close (); ast
|
|
||||||
|
|
||||||
let mono_contract = Parser.contract
|
|
||||||
|
|
||||||
end
|
|
||||||
|
@ -1,50 +1,16 @@
|
|||||||
(** Generic parser API for LIGO *)
|
(** Generic parser API for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
|
||||||
|
|
||||||
type token
|
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
|
||||||
|
|
||||||
exception Error
|
|
||||||
|
|
||||||
(* The monolithic API *)
|
|
||||||
|
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
|
||||||
|
|
||||||
(* The incremental API *)
|
|
||||||
|
|
||||||
module MenhirInterpreter :
|
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
|
||||||
with type token = token
|
|
||||||
end
|
|
||||||
|
|
||||||
module Incremental :
|
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
(* Errors *)
|
(* Errors *)
|
||||||
|
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
|
||||||
val message : int -> string (* From error states to messages *)
|
|
||||||
end
|
|
||||||
|
|
||||||
val format_error :
|
val format_error :
|
||||||
?offsets:bool -> [`Byte | `Point] ->
|
?offsets:bool -> [`Byte | `Point] ->
|
||||||
string Region.reg -> file:bool -> string
|
string Region.reg -> file:bool -> string
|
||||||
|
|
||||||
(* Main functor *)
|
(* Main functor *)
|
||||||
|
|
||||||
module Make (Lexer: Lexer.S)
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
(Parser: module type of Parser)
|
||||||
(ParErr: PAR_ERR) :
|
(ParErr: sig val message: int -> string end) :
|
||||||
sig
|
sig
|
||||||
type message = string
|
type message = string
|
||||||
type valid = Lexer.token
|
type valid = Lexer.token
|
||||||
|
@ -1,98 +1,64 @@
|
|||||||
(** Generic parser for LIGO *)
|
(** Generic parser for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
(* Errors *)
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
||||||
|
let reg = region#to_string ~file ~offsets mode in
|
||||||
type token
|
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
(* Main functor *)
|
||||||
|
|
||||||
exception Error
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
|
(Parser: module type of Parser)
|
||||||
(* The monolithic API *)
|
(ParErr: sig val message : int -> string end) =
|
||||||
|
struct
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
type message = string
|
||||||
|
type valid = Lexer.token
|
||||||
(* The incremental API *)
|
type invalid = Lexer.token
|
||||||
|
|
||||||
module MenhirInterpreter :
|
exception Point of message * valid option * invalid
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
module I = Parser.MenhirInterpreter
|
||||||
with type token = token
|
module S = MenhirLib.General (* Streams *)
|
||||||
end
|
|
||||||
|
(* The call [stack checkpoint] extracts the parser's stack out of
|
||||||
module Incremental :
|
a checkpoint. *)
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
let stack = function
|
||||||
end
|
I.HandlingError env -> I.stack env
|
||||||
end
|
| _ -> assert false
|
||||||
|
|
||||||
(* Errors *)
|
(* The call [state checkpoint] extracts the number of the current
|
||||||
|
state out of a parser checkpoint. *)
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
let state checkpoint : int =
|
||||||
val message : int -> string (* From error states to messages *)
|
match Lazy.force (stack checkpoint) with
|
||||||
end
|
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
||||||
|
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
||||||
let format_error ?(offsets=true) mode Region.{region; value} ~file =
|
|
||||||
let reg = region#to_string ~file ~offsets mode in
|
(* The parser has successfully produced a semantic value. *)
|
||||||
Printf.sprintf "\027[31mParse error %s:\n%s\027[0m%!" reg value
|
|
||||||
|
let success v = v
|
||||||
(* Main functor *)
|
|
||||||
|
(* The parser has suspended itself because of a syntax error. Stop. *)
|
||||||
module Make (Lexer: Lexer.S)
|
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
let failure get_win checkpoint =
|
||||||
(ParErr: PAR_ERR) =
|
let message = ParErr.message (state checkpoint) in
|
||||||
struct
|
match get_win () with
|
||||||
type message = string
|
Lexer.Nil -> assert false
|
||||||
type valid = Lexer.token
|
| Lexer.One invalid ->
|
||||||
type invalid = Lexer.token
|
raise (Point (message, None, invalid))
|
||||||
|
| Lexer.Two (invalid, valid) ->
|
||||||
exception Point of message * valid option * invalid
|
raise (Point (message, Some valid, invalid))
|
||||||
|
|
||||||
module I = Parser.MenhirInterpreter
|
(* The generic parsing function *)
|
||||||
module S = MenhirLib.General (* Streams *)
|
|
||||||
|
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
||||||
(* The call [stack checkpoint] extracts the parser's stack out of
|
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
||||||
a checkpoint. *)
|
and failure = failure get_win in
|
||||||
|
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
||||||
let stack = function
|
let ast = I.loop_handle success failure supplier parser
|
||||||
I.HandlingError env -> I.stack env
|
in close (); ast
|
||||||
| _ -> assert false
|
|
||||||
|
let mono_contract = Parser.contract
|
||||||
(* The call [state checkpoint] extracts the number of the current
|
end
|
||||||
state out of a parser checkpoint. *)
|
|
||||||
|
|
||||||
let state checkpoint : int =
|
|
||||||
match Lazy.force (stack checkpoint) with
|
|
||||||
S.Nil -> 0 (* WARNING: Hack. The first state should be 0. *)
|
|
||||||
| S.Cons (I.Element (s,_,_,_),_) -> I.number s
|
|
||||||
|
|
||||||
(* The parser has successfully produced a semantic value. *)
|
|
||||||
|
|
||||||
let success v = v
|
|
||||||
|
|
||||||
(* The parser has suspended itself because of a syntax error. Stop. *)
|
|
||||||
|
|
||||||
let failure get_win checkpoint =
|
|
||||||
let message = ParErr.message (state checkpoint) in
|
|
||||||
match get_win () with
|
|
||||||
Lexer.Nil -> assert false
|
|
||||||
| Lexer.One invalid ->
|
|
||||||
raise (Point (message, None, invalid))
|
|
||||||
| Lexer.Two (invalid, valid) ->
|
|
||||||
raise (Point (message, Some valid, invalid))
|
|
||||||
|
|
||||||
(* The generic parsing function *)
|
|
||||||
|
|
||||||
let incr_contract Lexer.{read; buffer; get_win; close; _} : AST.t =
|
|
||||||
let supplier = I.lexer_lexbuf_to_supplier read buffer
|
|
||||||
and failure = failure get_win in
|
|
||||||
let parser = Parser.Incremental.contract buffer.Lexing.lex_curr_p in
|
|
||||||
let ast = I.loop_handle success failure supplier parser
|
|
||||||
in close (); ast
|
|
||||||
|
|
||||||
let mono_contract = Parser.contract
|
|
||||||
|
|
||||||
end
|
|
||||||
|
@ -1,50 +1,16 @@
|
|||||||
(** Generic parser API for LIGO *)
|
(** Generic parser API for LIGO *)
|
||||||
|
|
||||||
module type PARSER =
|
|
||||||
sig
|
|
||||||
(* The type of tokens *)
|
|
||||||
|
|
||||||
type token
|
|
||||||
|
|
||||||
(* This exception is raised by the monolithic API functions *)
|
|
||||||
|
|
||||||
exception Error
|
|
||||||
|
|
||||||
(* The monolithic API *)
|
|
||||||
|
|
||||||
val contract : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> AST.t
|
|
||||||
|
|
||||||
(* The incremental API *)
|
|
||||||
|
|
||||||
module MenhirInterpreter :
|
|
||||||
sig
|
|
||||||
include MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE
|
|
||||||
with type token = token
|
|
||||||
end
|
|
||||||
|
|
||||||
module Incremental :
|
|
||||||
sig
|
|
||||||
val contract : Lexing.position -> AST.t MenhirInterpreter.checkpoint
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
(* Errors *)
|
(* Errors *)
|
||||||
|
|
||||||
module type PAR_ERR =
|
|
||||||
sig
|
|
||||||
val message : int -> string (* From error states to messages *)
|
|
||||||
end
|
|
||||||
|
|
||||||
val format_error :
|
val format_error :
|
||||||
?offsets:bool -> [`Byte | `Point] ->
|
?offsets:bool -> [`Byte | `Point] ->
|
||||||
string Region.reg -> file:bool -> string
|
string Region.reg -> file:bool -> string
|
||||||
|
|
||||||
(* Main functor *)
|
(* Main functor *)
|
||||||
|
|
||||||
module Make (Lexer: Lexer.S)
|
module Make (Lexer: Lexer.S with module Token := LexToken)
|
||||||
(Parser: PARSER with type token = Lexer.Token.token)
|
(Parser: module type of Parser)
|
||||||
(ParErr: PAR_ERR) :
|
(ParErr: sig val message: int -> string end) :
|
||||||
sig
|
sig
|
||||||
type message = string
|
type message = string
|
||||||
type valid = Lexer.token
|
type valid = Lexer.token
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
Markup
|
Markup
|
||||||
FQueue
|
FQueue
|
||||||
EvalOpt
|
EvalOpt
|
||||||
Version
|
Version))
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(rule
|
(rule
|
||||||
(targets Version.ml)
|
(targets Version.ml)
|
||||||
|
Loading…
Reference in New Issue
Block a user