[m-rev.] for review: \e as ESC, stage 1

Julien Fischer jfischer at opturion.com
Sun Apr 28 13:00:05 AEST 2024


On Sun, 28 Apr 2024, Zoltan Somogyi wrote:

> Add support for \e as the escape char, stage 1.
> 
> library/mercury_term_lexer.m:
>     Convert any occurrences of the \e escape sequence to the escape character.
>
>     List all the places in the library and the compiler that also list
>     escape sequences, some of which contains all these sequences,
>     and some of which contain subsets.
>
>     Sort the letters in recognized escape sequences.

...

> diff --git a/library/mercury_term_lexer.m b/library/mercury_term_lexer.m
> index 9a960f9f6..4950cf871 100644
> --- a/library/mercury_term_lexer.m
> +++ b/library/mercury_term_lexer.m
> @@ -2063,14 +2063,28 @@ linestr_get_quoted_name_escape(String, Len, QuoteChar, !.RevChars,
>          linestr_get_context(LineContext0, Context)
>      ).
> 
> +    % If you add a new escape character sequence, you must also update
> +    %
> +    %   quote_special_escape_char in library/rtti_implementation.m
> +    %   mercury_escape_special_char in library/term_io.m
> +    %   escape_special_char in compiler/parse_tree_out_pragma.m
> +    %
> +    % Any changes here may require changes at those places as well.

Additional places that require updating are:

      MR_escape_string_quote in runtime/mercury_string.c
      The MR_TYPECTOR_REP_CHAR case in the big switch in runtime/mercury_ml_expand_body.h

The diff looks fine otherwise.

Julien.


More information about the reviews mailing list