|
Camlp4
encounters such a construction, the appropriate
quotation expander is called with the string contents of the
quotation.OCaml
syntax if the
language syntax used is the normal syntax, in revised syntax if the language
syntax is the revised syntax, etc.
|
<<
'' and end with
``>>
''. The associated expander is the ``default'' expander.
<:id<
'' and end with
``>>
'', where ``id
'' is any identifier. The associated
expander is the expander named ``id
''.
<<
'', ``<:id<
'' and
``>>
'', if not matching, must be prefixed by a backslash and
backslashes must be doubled.
|
Quotation.add
'' (see
section ??) adds the quotation expander. The variable
``Quotation.default
'' holds the name of the default
quotation.-I
''). An object file (ending with
``.cmo
'') is created, which is loadable in Camlp4, as parameter
of the command ``camlp4'', or in the OCaml toplevel using the
directive ``#load
''.
|
|
|
Stdpp.raise_with_loc
'' instead instead of ``raise
'',
this first function having a supplementary parameter which is the
location of the error relative to the begin of the quotation. In this
case, the error message highlights only the located part of the
quotation.
|
-QD
'' (see the manual page). It is also possible to set the
variable ``Pcaml.quotation_dump_file
'' (see section
??). The offending string is then written in a file (whose
name is specified by this option or this variable) and the error
message gives the location of the error in this file. This technique
is useful when perfecting or debugging the quotation expander: a good
quotation expander should never generate errored strings.
|
Plexer
), is:
location_directive ::= $ int : string $ |
|
q_MLast.cmo
''
allowing to create abstract syntax tree nodes from concrete revised
syntax. It is used in language syntax extensions
(chapter 5).q_phony.cmo
''. It
transforms all quotations into variables whose name holds all the text
of the quotation, <<
and >>
included. It is useful for
pretty printing programs with the quotations not expanded.