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
.RS
.IP \(bu 2
Format: \fB\fC"[:print:]+"\fR
Format: \fB\fC(["'])[:print:]+\\1\fR
.RE
.PP
A string is always surrounded by double quotes (\fB\fC"\fR). Between the quotes there
can be any printable character.
Strings are always surrounded by double (\fB\fC"\fR) or single (\fB\fC\&'\fR, apostrophe) quotes. Between
the quotes there can be any printable character.
.PP
For example:
@ -592,15 +592,16 @@ The string must be valid UTF-8, special characters can be escaped:
.RS
.nf
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"'; }
text { content: "Line one\\n\\tIndented line two \\"Quoted text\\""; }
.fi
.RE
.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
.RS

View File

@ -379,10 +379,10 @@ Some of these types are a combination of other types.
### String
- Format: `"[:print:]+"`
- Format: `(["'])[:print:]+\1`
A string is always surrounded by double quotes (`"`). Between the quotes there
can be any printable character.
Strings are always surrounded by double (`"`) or single (`'`, apostrophe) quotes. Between
the quotes there can be any printable character.
For example:
@ -393,12 +393,13 @@ font: "Awasome 12";
The string must be valid UTF-8, special characters can be escaped:
```css
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"'; }
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

View File

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