3ed303f60d
like the absence of an input filename. (This simplifies all the clients codes.) Fixed the dune file for the preprocessor. Fixed the build of PreprocMain.exe and PreprocMain.byte. Restricted preprocessing errors [Preproc.Newline_in_string] and [Preproc.Open_string] to the argument of the #include directive (instead of general strings: this is for the LIGO lexer to report the error). I removed the error [Preproc.Open_comment] as this is for the LIGO lexer to report. The preprocessor scanner [Preproc.lex] does not take a parameter [is_file:bool] now: the source file (if any) is determined from the lexing buffer. Accordingly, the field [is_file] of the state of the preprocessing lexer has been removed: the lexing buffer becomes now the reference for the input source (bug fix and interface improvement). Fixed the comments of the test contract pledge.religo. I removed the data constructor [Lexer.Stdin], as redundant with [Lexer.Channel]. |
||
---|---|---|
.. | ||
.E_LexerMain.tag | ||
.E_Parser.mly.tag | ||
.E_ParserMain.tag | ||
.links | ||
.PreprocMain.ml | ||
.PreprocMain.tag | ||
build.sh | ||
clean.sh | ||
dune | ||
dune-project | ||
E_AST.ml | ||
E_Lexer.mli | ||
E_Lexer.mll | ||
E_LexerMain.ml | ||
E_Parser.mly | ||
E_ParserMain.ml | ||
EvalOpt.ml | ||
EvalOpt.mli | ||
LICENSE | ||
Makefile.cfg | ||
Preproc.mli | ||
Preproc.mll | ||
Preprocessor.ml | ||
Preprocessor.opam | ||
PreprocMain.ml | ||
README.md |
A preprocessor a la C# in OCaml
The following preprocessing directives are supported
- #define
- #elif
- #else
- #endif
- #endregion
- #error
- #if
- #include
- #region
- #undef
Note: Because it is meant for LIGO, there is no error raised for
invalid preprocessing directives, as the symbol #
is valid in
PascaLIGO (cons operator for lists). Also, the preprocessor may report an error on some weird but valid PascaLIGO contracts, like
const include : list (int) = list [1] const l : list (int) = 0