vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python filter: incomplete triple-quoted string support


From: Marc Simpson
Subject: Python filter: incomplete triple-quoted string support
Date: Tue, 4 Feb 2020 20:55:55 -0800

The current filter (py-filt.l) only supports triple-quoted strings
formed with double quotes; single quote multi-line literals are
incorrectly highlighted, e.g.

    '''
    'foo'
    bar
    '''

Naive patch: declare QUOTE4, duplicate and adapt the existing QUOTE3
block:

    %s NORMAL QUOTE1 QUOTE2 QUOTE3 QUOTE4

    ...

    <NORMAL>\'\'\'  { BeginQuote(QUOTE4, String_attr); }
    <QUOTE4>\'\'\'  { FinishQuote(NORMAL); }
    <QUOTE4>(\\.|.) { flt_bfr_append(yytext, yyleng); }
    <QUOTE4>[\n]    { flt_bfr_append(yytext, yyleng); }

(This can surely be simplified.)

Best,
Marc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]