You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

4 years ago
  1. var TYPE = require('../../tokenizer').TYPE;
  2. var STRING = TYPE.String;
  3. var IDENT = TYPE.Ident;
  4. var URL = TYPE.Url;
  5. var FUNCTION = TYPE.Function;
  6. var LEFTPARENTHESIS = TYPE.LeftParenthesis;
  7. module.exports = {
  8. parse: {
  9. prelude: function() {
  10. var children = this.createList();
  11. this.scanner.skipSC();
  12. switch (this.scanner.tokenType) {
  13. case STRING:
  14. children.push(this.String());
  15. break;
  16. case URL:
  17. case FUNCTION:
  18. children.push(this.Url());
  19. break;
  20. default:
  21. this.error('String or url() is expected');
  22. }
  23. if (this.lookupNonWSType(0) === IDENT ||
  24. this.lookupNonWSType(0) === LEFTPARENTHESIS) {
  25. children.push(this.WhiteSpace());
  26. children.push(this.MediaQueryList());
  27. }
  28. return children;
  29. },
  30. block: null
  31. }
  32. };