parserlib: dot-separated layer names

This commit is contained in:
tophf 2022-10-19 19:15:53 +03:00
parent 1725c0ecb9
commit fc39f0d5a6

View File

@ -3503,7 +3503,7 @@ self.parserlib = (() => {
do { do {
this._ws(); this._ws();
if ((t = stream.get(true)).type === Tokens.IDENT) { if ((t = stream.get(true)).type === Tokens.IDENT) {
ids.push(t.value); ids.push(this._layerName(t));
this._ws(); this._ws();
t = stream.get(true); t = stream.get(true);
} }
@ -3521,6 +3521,16 @@ self.parserlib = (() => {
this._ws(); this._ws();
} }
_layerName(start) {
let res = '';
const stream = this._tokenStream;
for (let t; (t = start || stream.match(Tokens.IDENT));) {
res += t.value + (stream.match(Tokens.DOT) ? '.' : '');
start = false;
}
return res;
}
_stylesheet() { _stylesheet() {
const stream = this._tokenStream; const stream = this._tokenStream;
this.fire('startstylesheet'); this.fire('startstylesheet');
@ -3590,7 +3600,7 @@ self.parserlib = (() => {
this._ws(); this._ws();
t = stream.get(true); t = stream.get(true);
if (/^layer(\()?$/i.test(t.value)) { if (/^layer(\()?$/i.test(t.value)) {
layer = RegExp.$1 ? stream.mustMatch(Tokens.IDENT) : ''; layer = RegExp.$1 ? this._layerName() : '';
if (layer) stream.mustMatch(Tokens.RPAREN); if (layer) stream.mustMatch(Tokens.RPAREN);
this._ws(); this._ws();
t = stream.get(true); t = stream.get(true);