Support single quotes for strings as in CSS

This commit is contained in:
Nikita Zlobin 2023-08-21 16:23:41 +05:00 committed by Dave Davenport
parent 664f1b9297
commit c6f3cfb7d7
3 changed files with 25 additions and 21 deletions

View file

@ -565,13 +565,13 @@ Some of these types are a combination of other types.
.SS String .SS String
.RS .RS
.IP \(bu 2 .IP \(bu 2
Format: \fB\fC"[:print:]+"\fR Format: \fB\fC(["'])[:print:]+\\1\fR
.RE .RE
.PP .PP
A string is always surrounded by double quotes (\fB\fC"\fR). Between the quotes there Strings are always surrounded by double (\fB\fC"\fR) or single (\fB\fC\&'\fR, apostrophe) quotes. Between
can be any printable character. the quotes there can be any printable character.
.PP .PP
For example: For example:
@ -592,15 +592,16 @@ The string must be valid UTF-8, special characters can be escaped:
.RS .RS
.nf .nf
text { text { content: "Line one\\n\\tIndented line two 'Quoted text'"; }
content: "Line one\\n\\tIndented line two"; text { content: 'Line one\\n\\tIndented line two "Quoted text"'; }
} text { content: "Line one\\n\\tIndented line two \\"Quoted text\\""; }
.fi .fi
.RE .RE
.PP .PP
The following special characters can be escaped: \fB\fC\\b\fR, \fB\fC\\f\fR, \fB\fC\\n\fR, \fB\fC\\r\fR, \fB\fC\\t\fR, \fB\fC\\v\fR, \fB\fC\\\fR and \fB\fC"\fR\&. The following special characters can be escaped: \fB\fC\\b\fR, \fB\fC\\f\fR, \fB\fC\\n\fR, \fB\fC\\r\fR, \fB\fC\\t\fR, \fB\fC\\v\fR, \fB\fC\\\fR,
\fB\fC"\fR and \fB\fC\&'\fR (double quotes inside single-quotes or in reverse don't need escape).
.SS Integer .SS Integer
.RS .RS

View file

@ -379,10 +379,10 @@ Some of these types are a combination of other types.
### String ### String
- Format: `"[:print:]+"` - Format: `(["'])[:print:]+\1`
A string is always surrounded by double quotes (`"`). Between the quotes there Strings are always surrounded by double (`"`) or single (`'`, apostrophe) quotes. Between
can be any printable character. the quotes there can be any printable character.
For example: For example:
@ -393,12 +393,13 @@ font: "Awasome 12";
The string must be valid UTF-8, special characters can be escaped: The string must be valid UTF-8, special characters can be escaped:
```css ```css
text { text { content: "Line one\n\tIndented line two 'Quoted text'"; }
content: "Line one\n\tIndented line two"; text { content: 'Line one\n\tIndented line two "Quoted text"'; }
} text { content: "Line one\n\tIndented line two \"Quoted text\""; }
``` ```
The following special characters can be escaped: `\b`, `\f`, `\n`, `\r`, `\t`, `\v`, `\` and `"`. The following special characters can be escaped: `\b`, `\f`, `\n`, `\r`, `\t`, `\v`, `\`,
`"` and `'` (double quotes inside single-quotes or in reverse don't need escape).
### Integer ### Integer

View file

@ -163,17 +163,19 @@ static double rofi_theme_parse_convert_hex ( char high, char low)
ASC [\x00-\x7f] ASC [\x00-\x7f]
ASCN [\x00-\t\v-\x7f] ASCN [\x00-\t\v-\x7f]
ASCNP [\x00-\t\v-\x21\x23-\x7f] ASCNP1 [\x00-\t\v-\x21\x23-\x7f]
ASCNP2 [\x00-\t\v-\x26\x28-\x7f]
U [\x80-\xbf] U [\x80-\xbf]
U2 [\xc2-\xdf] U2 [\xc2-\xdf]
U3 [\xe0-\xef] U3 [\xe0-\xef]
U4 [\xf0-\xf4] U4 [\xf0-\xf4]
// UANY {ASC}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
UANYN {ASCN}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} // UANY {ASC}|{UONLY}
// UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} UANYN {ASCN}|{UONLY}
UANYNP {ASCNP}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} UANYNP1 {ASCNP1}|{UONLY}
UANYNP2 {ASCNP2}|{UONLY}
WHITESPACE [[:blank:]] WHITESPACE [[:blank:]]
WSO [[:blank:]]* WSO [[:blank:]]*
@ -181,8 +183,8 @@ WORD [[:alnum:]-]+
WORD_ELEMENT [[:alpha:]][[:alnum:]-]* WORD_ELEMENT [[:alpha:]][[:alnum:]-]*
WORD_ENV [[:alpha:]_][[:alnum:]_]* WORD_ENV [[:alpha:]_][[:alnum:]_]*
COLOR_NAME [[:alpha:]]+ COLOR_NAME [[:alpha:]]+
STRING \"{UANYN}*\" STRING \"{UANYN}*\"|\'{UANYN}*\'
STRING_LIST \"{UANYNP}*\" STRING_LIST \"{UANYNP1}*\"|\'{UANYNP2}*\'
CHAR \'({ASCN}|\\\\|\\\'|\\0)\' CHAR \'({ASCN}|\\\\|\\\'|\\0)\'
HEX [[:xdigit:]] HEX [[:xdigit:]]
NUMBER [[:digit:]]+ NUMBER [[:digit:]]+