diff --git a/CHANGES.md b/CHANGES.md index 5f0b2bdedc..19de6f1187 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ New styles: none. Improvements: +- enh(ebnf) add backticks as additional string variant (#2290) [Chris Marchesi][] - fix(themes): fix inconsistencies between some themes padding/spacing (#2300) [Josh Goebel][] - chore(javascript): add esm related extensions to aliases (#2298) [Rongjian Zhang][] - fix(kotlin): fix termination of """ string literals (#2295) [Josh Goebel][] diff --git a/src/languages/ebnf.js b/src/languages/ebnf.js index cf24f1d600..c4a2256ab3 100644 --- a/src/languages/ebnf.js +++ b/src/languages/ebnf.js @@ -22,8 +22,15 @@ function(hljs) { contains: [ commentMode, specialSequenceMode, - // terminals - hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE + { + // terminals + className: 'string', + variants: [ + hljs.APOS_STRING_MODE, + hljs.QUOTE_STRING_MODE, + {begin: '`', end: '`'}, + ] + }, ] }; diff --git a/test/markup/ebnf/quote-symbols.expect.txt b/test/markup/ebnf/quote-symbols.expect.txt new file mode 100644 index 0000000000..595a99089f --- /dev/null +++ b/test/markup/ebnf/quote-symbols.expect.txt @@ -0,0 +1,8 @@ +first_quote_symbol = "'" . +second_quote_symbol = '"' . + +(* escaped_quote_symbol tests backticks, which does not interfere + * with backslashes. It has precedent in some language + * specifications. + *) +escaped_quote_symbol = `\` ( first_quote_symbol | second_quote_symbol ) . diff --git a/test/markup/ebnf/quote-symbols.txt b/test/markup/ebnf/quote-symbols.txt new file mode 100644 index 0000000000..d2bd980c92 --- /dev/null +++ b/test/markup/ebnf/quote-symbols.txt @@ -0,0 +1,8 @@ +first_quote_symbol = "'" . +second_quote_symbol = '"' . + +(* escaped_quote_symbol tests backticks, which does not interfere + * with backslashes. It has precedent in some language + * specifications. + *) +escaped_quote_symbol = `\` ( first_quote_symbol | second_quote_symbol ) .