Alhadis / language-grammars

Syntax highlighting for ABNF/BNF/EBNF, Yacc, and other language-related languages.
https://atom.io/packages/language-grammars
ISC License
19 stars 5 forks source link

ABNF - rule allowing literal DQUOTE breaks highlighting #2

Closed jchook closed 4 years ago

jchook commented 4 years ago

How do I specify a production rule allowing a literal DQUOTE?

For example, check out RFC 2045. They appear to use prose-val to specify a literal double quote <">, but it would seem that char-val otherwise allows """. Both options cause a "run-on" quoted string in the syntax highlighting (see screenshot).

The formal ABNF specification specifies:

char-val       =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
prose-val      =  "<" *(%x20-3D / %x3F-7E) ">"

Also, thanks a lot for making this!

image

Alhadis commented 4 years ago

Weird that I completely missed prose-val while going through RFC 5234. 🤔 I've amended this in 422d721; thanks for bringing it to my attention.

but it would seem that char-val otherwise allows """

Where did you read that? The formal definition of char-val explicitly excludes DQUOTE (U+0022) from its permitted character range:

char-val       =  DQUOTE *(%x20-21 / %x23-7E) DQUOTE
                    ; quoted string of SP and VCHAR
                    ;  without DQUOTE
jchook commented 4 years ago

I've amended this in 422d721; thanks for bringing it to my attention.

Thank you! :)

The formal definition of char-val explicitly excludes DQUOTE.

Yep, good point. I misread the definition. Thanks again!

Alhadis commented 4 years ago

Glad to help! I've just cut a release, so the recent fixes should be available to you immediately.