[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] nano bug #54928: a syntax file should be fully read onl
From: |
Brand Huntsman |
Subject: |
Re: [Nano-devel] nano bug #54928: a syntax file should be fully read only when the syntax gets actually used |
Date: |
Wed, 14 Nov 2018 16:04:32 -0700 |
On Wed, 14 Nov 2018 19:49:54 +0100
Benno Schulenberg <address@hidden> wrote:
> Hmm... Maybe it's not even possible, because of the 'extendsyntax'
> command. Or it would mean re-evaluating each nanorc that contains
> an extendsyntax command whenever switching to a new syntax. :|
You could add a filestruct list to syntaxtype and store each extendsyntax line
(everything after the syntax name) there for unloaded syntaxes. I'd rather have
a few extendsyntax strings always loaded than having a hundred syntaxes and
their regexes always loaded.
After loading the syntax, iterate the list, evaluate and free each line. You
will need to move the "syntax" upto but excluding "include" conditionals from
parse_rcfile() to a separate function.
/* Try to parse the keyword. */
if (parse_syntax_commands(...))
/* Nothing happens here, it was handled in the function call. */
else if (strcasecmp(keyword, "include") == 0)
...
And when evaluating each extendsyntax line:
if (!parse_syntax_commands(...))
rcfile_error(N_("Command \"%s\" not understood"), keyword);