(stream, state)
| 18 | } |
| 19 | |
| 20 | function tokenBase(stream, state) { |
| 21 | var ch = stream.next(); |
| 22 | |
| 23 | if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());} |
| 24 | else if (ch == "/" && stream.eat("*")) { |
| 25 | state.tokenize = tokenCComment; |
| 26 | return tokenCComment(stream, state); |
| 27 | } |
| 28 | else if (ch == "<" && stream.eat("!")) { |
| 29 | state.tokenize = tokenSGMLComment; |
| 30 | return tokenSGMLComment(stream, state); |
| 31 | } |
| 32 | else if (ch == "=") ret(null, "compare"); |
| 33 | else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); |
| 34 | else if (ch == "\"" || ch == "'") { |
| 35 | state.tokenize = tokenString(ch); |
| 36 | return state.tokenize(stream, state); |
| 37 | } |
| 38 | else if (ch == "/") { // lesscss e.g.: .png will not be parsed as a class |
| 39 | if(stream.eat("/")){ |
| 40 | state.tokenize = tokenSComment |
| 41 | return tokenSComment(stream, state); |
| 42 | }else{ |
| 43 | stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/); |
| 44 | if(/\/|\)|#/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == ")")))return ret("string", "string");//let url(/images/logo.png) without quotes return as string |
| 45 | return ret("number", "unit"); |
| 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)) {//removed . dot character original was [,.+>*\/] |
| 57 | return ret(null, "select-op"); |
| 58 | } |
| 59 | else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]] |
| 60 | if(ch == ":"){ |
| 61 | stream.eatWhile(/[active|hover|link|visited]/); |
| 62 | if( stream.current().match(/active|hover|link|visited/)){ |
| 63 | return ret("tag", "tag"); |
| 64 | }else{ |
| 65 | return ret(null, ch); |
| 66 | } |
| 67 | }else{ |
| 68 | return ret(null, ch); |
| 69 | } |
| 70 | } |
| 71 | else if (ch == ".") { // lesscss |
| 72 | stream.eatWhile(/[\a-zA-Z0-9\-_]/); |
| 73 | return ret("tag", "tag"); |
| 74 | } |
| 75 | else if (ch == "#") { // lesscss |
| 76 | //we don't eat white-space, we want the hex color and or id only |
| 77 | stream.eatWhile(/[A-Za-z0-9]/); |
nothing calls this directly
no test coverage detected