unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Faces in bash-ts-mode
@ 2023-03-03  7:53 Eli Zaretskii
  2023-03-05 22:23 ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-03-03  7:53 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

Is there an easy way of having some of the sh-script's special faces
in bash-ts-mode?  The one I spotted to be missing is
sh-escaped-newline, but maybe sh-quoted-exec is also missing?

Also, do we use sh-heredoc face for here-documents in bash-ts-mode?
If not, can we use it in that case?

Thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Faces in bash-ts-mode
  2023-03-03  7:53 Faces in bash-ts-mode Eli Zaretskii
@ 2023-03-05 22:23 ` Yuan Fu
  2023-03-06 12:49   ` Eli Zaretskii
  2023-03-06 13:10   ` Yuri Khan
  0 siblings, 2 replies; 4+ messages in thread
From: Yuan Fu @ 2023-03-05 22:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel



> On Mar 2, 2023, at 11:53 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> Is there an easy way of having some of the sh-script's special faces
> in bash-ts-mode?  The one I spotted to be missing is
> sh-escaped-newline, but maybe sh-quoted-exec is also missing?

I added support for sh-quoted-exec, but because tree-sitter ignores the escaped newline, it doesn’t show up in the parse tree, so it’s not as easy to support that.

I not an expert in bash syntax, can I assume that an backslash at the end of a line that’s not in a string must be an escaped newline?

> Also, do we use sh-heredoc face for here-documents in bash-ts-mode?
> If not, can we use it in that case?

We do, so that’s taken care of :-)

Yuan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Faces in bash-ts-mode
  2023-03-05 22:23 ` Yuan Fu
@ 2023-03-06 12:49   ` Eli Zaretskii
  2023-03-06 13:10   ` Yuri Khan
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-03-06 12:49 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 5 Mar 2023 14:23:06 -0800
> Cc: emacs-devel@gnu.org
> 
> I not an expert in bash syntax, can I assume that an backslash at the end of a line that’s not in a string must be an escaped newline?

I guess so.  (I'm not an expert, either.)

> > Also, do we use sh-heredoc face for here-documents in bash-ts-mode?
> > If not, can we use it in that case?
> 
> We do, so that’s taken care of :-)

Thanks!



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Faces in bash-ts-mode
  2023-03-05 22:23 ` Yuan Fu
  2023-03-06 12:49   ` Eli Zaretskii
@ 2023-03-06 13:10   ` Yuri Khan
  1 sibling, 0 replies; 4+ messages in thread
From: Yuri Khan @ 2023-03-06 13:10 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, emacs-devel

On Mon, 6 Mar 2023 at 05:23, Yuan Fu <casouri@gmail.com> wrote:

> I not an expert in bash syntax, can I assume that an backslash at the end of a line that’s not in a string must be an escaped newline?

I don’t know the full context, but a backslash at the end of a line
could be a backslash-escaped backslash:

    echo \\
    # that was a command to output a single backslash

and the whole heuristic if you’re not doing a full parser would
probably be “a backslash at the end of a line that is preceded by an
even number (incl. 0) of backslashes is an escaped newline”.

    echo \\\
        this is a continuation line



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-06 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03  7:53 Faces in bash-ts-mode Eli Zaretskii
2023-03-05 22:23 ` Yuan Fu
2023-03-06 12:49   ` Eli Zaretskii
2023-03-06 13:10   ` Yuri Khan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).