Skip to content

Parser checks quotes in command substitution comments #7866

@OwenAR

Description

@OwenAR

Is this a bug in the parser, such that it sees unbalanced quotes within a comment (within this context (command substitution?) as an error, or..?

This works:

	echo (
	test ""
	and echo a # comment 1 ''
	or  echo b # comment 2 ''
	)

But this gets an error:

	echo (
	test ""
	and echo a # comment 1 '''
	or  echo b # comment 2 ''
	)
	fish: Unexpected end of string, quotes are not balanced
	and echo a # '
	             ^

(fish, version 2.7.1 (ppa 3.2.1-1~focal))

(
Also work:

	echo (
	test ""
	and echo a # comment 1 '''
	or  echo b # comment 2 '''
	)
	echo (
	test ""
	and echo a # comment 1 '
	or  echo b # comment 2 '
	)

and of course:

	echo (
	test ""
	and echo a # comment 1
	or  echo b # comment 2
	)

...

a few other notes:

✔️ works:

	echo (
	test ""
	and echo a # comment 1 '
	or  echo b # comment 2
	#'
	)

❌ fails:

	echo (
	test ""
	and echo a # comment 1 '
	or  echo b # comment 2
	) #'

❌ fails:

	echo (
	test ""
	and echo a # comment 1 '
	or  echo b # comment 2
	)
	#'

✔️ works:

	echo ( #'
	test ""
	and echo a # comment 1 '
	or  echo b # comment 2
	)

)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions