show an error for misplaced @document

#367
This commit is contained in:
tophf 2018-03-21 09:32:32 +03:00
parent dd5cd5c686
commit b185140176

View File

@ -4235,6 +4235,14 @@ self.parserlib = (() => {
this._ws(); this._ws();
} }
_documentMisplaced() {
this.fire({
type: 'error',
message: 'Nested @document produces broken code',
}, this._tokenStream.LT(1));
this._document();
}
_documentFunction() { _documentFunction() {
const stream = this._tokenStream; const stream = this._tokenStream;
return stream.match(Tokens.URI) ? return stream.match(Tokens.URI) ?
@ -5303,7 +5311,7 @@ self.parserlib = (() => {
document: new Map([ document: new Map([
[Tokens.MEDIA_SYM, Parser.prototype._media], [Tokens.MEDIA_SYM, Parser.prototype._media],
[Tokens.DOCUMENT_SYM, Parser.prototype._document], [Tokens.DOCUMENT_SYM, Parser.prototype._documentMisplaced],
[Tokens.SUPPORTS_SYM, Parser.prototype._supports], [Tokens.SUPPORTS_SYM, Parser.prototype._supports],
[Tokens.PAGE_SYM, Parser.prototype._page], [Tokens.PAGE_SYM, Parser.prototype._page],
[Tokens.FONT_FACE_SYM, Parser.prototype._fontFace], [Tokens.FONT_FACE_SYM, Parser.prototype._fontFace],
@ -5314,12 +5322,12 @@ self.parserlib = (() => {
supports: new Map([ supports: new Map([
[Tokens.MEDIA_SYM, Parser.prototype._media], [Tokens.MEDIA_SYM, Parser.prototype._media],
[Tokens.SUPPORTS_SYM, Parser.prototype._supports], [Tokens.SUPPORTS_SYM, Parser.prototype._supports],
[Tokens.DOCUMENT_SYM, Parser.prototype._document], [Tokens.DOCUMENT_SYM, Parser.prototype._documentMisplaced],
]), ]),
media: new Map([ media: new Map([
[Tokens.MEDIA_SYM, Parser.prototype._media], [Tokens.MEDIA_SYM, Parser.prototype._media],
[Tokens.DOCUMENT_SYM, Parser.prototype._document], [Tokens.DOCUMENT_SYM, Parser.prototype._documentMisplaced],
[Tokens.SUPPORTS_SYM, Parser.prototype._supports], [Tokens.SUPPORTS_SYM, Parser.prototype._supports],
[Tokens.PAGE_SYM, Parser.prototype._page], [Tokens.PAGE_SYM, Parser.prototype._page],
[Tokens.FONT_FACE_SYM, Parser.prototype._fontFace], [Tokens.FONT_FACE_SYM, Parser.prototype._fontFace],