(stream, state)
| 17 | var selectors = /(^\:root$|^\:nth\-child$|^\:nth\-last\-child$|^\:nth\-of\-type$|^\:nth\-last\-of\-type$|^\:first\-child$|^\:last\-child$|^\:first\-of\-type$|^\:last\-of\-type$|^\:only\-child$|^\:only\-of\-type$|^\:empty$|^\:link|^\:visited$|^\:active$|^\:hover$|^\:focus$|^\:target$|^\:lang$|^\:enabled^\:disabled$|^\:checked$|^\:first\-line$|^\:first\-letter$|^\:before$|^\:after$|^\:not$|^\:required$|^\:invalid$)/; |
| 18 | |
| 19 | function tokenBase(stream, state) { |
| 20 | var ch = stream.next(); |
| 21 | |
| 22 | if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());} |
| 23 | else if (ch == "/" && stream.eat("*")) { |
| 24 | state.tokenize = tokenCComment; |
| 25 | return tokenCComment(stream, state); |
| 26 | } |
| 27 | else if (ch == "<" && stream.eat("!")) { |
| 28 | state.tokenize = tokenSGMLComment; |
| 29 | return tokenSGMLComment(stream, state); |
| 30 | } |
| 31 | else if (ch == "=") ret(null, "compare"); |
| 32 | else if (ch == "|" && stream.eat("=")) return ret(null, "compare"); |
| 33 | else if (ch == "\"" || ch == "'") { |
| 34 | state.tokenize = tokenString(ch); |
| 35 | return state.tokenize(stream, state); |
| 36 | } |
| 37 | else if (ch == "/") { // e.g.: .png will not be parsed as a class |
| 38 | if(stream.eat("/")){ |
| 39 | state.tokenize = tokenSComment; |
| 40 | return tokenSComment(stream, state); |
| 41 | }else{ |
| 42 | if(type == "string" || type == "(")return ret("string", "string"); |
| 43 | if(state.stack[state.stack.length-1] != undefined)return ret(null, ch); |
| 44 | stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/); |
| 45 | if( /\/|\)|#/.test(stream.peek() || (stream.eatSpace() && stream.peek() == ")")) || stream.eol() )return ret("string", "string"); // let url(/images/logo.png) without quotes return as string |
| 46 | } |
| 47 | } |
| 48 | else if (ch == "!") { |
| 49 | stream.match(/^\s*\w*/); |
| 50 | return ret("keyword", "important"); |
| 51 | } |
| 52 | else if (/\d/.test(ch)) { |
| 53 | stream.eatWhile(/[\w.%]/); |
| 54 | return ret("number", "unit"); |
| 55 | } |
| 56 | else if (/[,+<>*\/]/.test(ch)) { |
| 57 | if(stream.peek() == "=" || type == "a")return ret("string", "string"); |
| 58 | return ret(null, "select-op"); |
| 59 | } |
| 60 | else if (/[;{}:\[\]()~\|]/.test(ch)) { |
| 61 | if(ch == ":"){ |
| 62 | stream.eatWhile(/[a-z\\\-]/); |
| 63 | if( selectors.test(stream.current()) ){ |
| 64 | return ret("tag", "tag"); |
| 65 | }else if(stream.peek() == ":"){//::-webkit-search-decoration |
| 66 | stream.next(); |
| 67 | stream.eatWhile(/[a-z\\\-]/); |
| 68 | if(stream.current().match(/\:\:\-(o|ms|moz|webkit)\-/))return ret("string", "string"); |
| 69 | if( selectors.test(stream.current().substring(1)) )return ret("tag", "tag"); |
| 70 | return ret(null, ch); |
| 71 | }else{ |
| 72 | return ret(null, ch); |
| 73 | } |
| 74 | }else if(ch == "~"){ |
| 75 | if(type == "r")return ret("string", "string"); |
| 76 | }else{ |
nothing calls this directly
no test coverage detected