1 %option case-insensitive 2 %option noyywrap 3 %option 8bit 4 %option stack 5 %s mediaquery 6 %s forkeyword 7 8 h [0-9a-fA-F] 9 nonascii [\200-\377] 10 unicode \\{h}{1,6}[ \t\r\n\f]? 11 escape {unicode}|\\[ -~\200-\377] 12 nmstart [_a-zA-Z]|{nonascii}|{escape} 13 nmchar [_a-zA-Z0-9-]|{nonascii}|{escape} 14 string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\" 15 string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\' 16 17 ident -?{nmstart}{nmchar}* 18 num [0-9]+|[0-9]*"."[0-9]+ 19 intnum [0-9]+ 20 string {string1}|{string2} 21 url ([!#$%&*-~]|{nonascii}|{escape})* 22 w [ \t\r\n\f]* 23 nl \n|\r\n|\r|\f 24 range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h}))))) 25 nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})? 26 27 %% 28 29 \/\*[^*]*\*+([^/*][^*]*\*+)*\/ {countLines(); /* ignore comments */ } 30 31 [ \t\r\n\f]+ {countLines(); yyTok = WHITESPACE; return yyTok;} 32 33 "<!--" {yyTok = SGML_CD; return yyTok;} 34 "-->" {yyTok = SGML_CD; return yyTok;} 35 "~=" {yyTok = INCLUDES; return yyTok;} 36 "|=" {yyTok = DASHMATCH; return yyTok;} 37 "^=" {yyTok = BEGINSWITH; return yyTok;} 38 "$=" {yyTok = ENDSWITH; return yyTok;} 39 "*=" {yyTok = CONTAINS; return yyTok;} 40 <mediaquery>"not" {yyTok = MEDIA_NOT; return yyTok;} 41 <mediaquery>"only" {yyTok = MEDIA_ONLY; return yyTok;} 42 <mediaquery>"and" {yyTok = MEDIA_AND; return yyTok;} 43 44 {string} {yyTok = STRING; return yyTok;} 45 {ident} {yyTok = IDENT; return yyTok;} 46 {nth} {yyTok = NTH; return yyTok;} 47 48 "#"{h}+ {yyTok = HEX; return yyTok;} 49 "#"{ident} {yyTok = IDSEL; return yyTok;} 50 51 "@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;} 52 "@page" {yyTok = PAGE_SYM; return yyTok;} 53 "@top-left-corner" {yyTok = TOPLEFTCORNER_SYM; return yyTok;} 54 "@top-left" {yyTok = TOPLEFT_SYM; return yyTok;} 55 "@top-center" {yyTok = TOPCENTER_SYM; return yyTok;} 56 "@top-right" {yyTok = TOPRIGHT_SYM; return yyTok;} 57 "@top-right-corner" {yyTok = TOPRIGHTCORNER_SYM; return yyTok;} 58 "@bottom-left-corner" {yyTok = BOTTOMLEFTCORNER_SYM; return yyTok;} 59 "@bottom-left" {yyTok = BOTTOMLEFT_SYM; return yyTok;} 60 "@bottom-center" {yyTok = BOTTOMCENTER_SYM; return yyTok;} 61 "@bottom-right" {yyTok = BOTTOMRIGHT_SYM; return yyTok;} 62 "@bottom-right-corner" {yyTok = BOTTOMRIGHTCORNER_SYM; return yyTok;} 63 "@left-top" {yyTok = LEFTTOP_SYM; return yyTok;} 64 "@left-middle" {yyTok = LEFTMIDDLE_SYM; return yyTok;} 65 "@left-bottom" {yyTok = LEFTBOTTOM_SYM; return yyTok;} 66 "@right-top" {yyTok = RIGHTTOP_SYM; return yyTok;} 67 "@right-middle" {yyTok = RIGHTMIDDLE_SYM; return yyTok;} 68 "@right-bottom" {yyTok = RIGHTBOTTOM_SYM; return yyTok;} 69 "@media" {BEGIN(mediaquery); yyTok = MEDIA_SYM; return yyTok;} 70 "@font-face" {yyTok = FONT_FACE_SYM; return yyTok;} 71 "@charset" {yyTok = CHARSET_SYM; return yyTok;} 72 "@namespace" {yyTok = NAMESPACE_SYM; return yyTok; } 73 "@-webkit-rule" {yyTok = WEBKIT_RULE_SYM; return yyTok; } 74 "@-webkit-decls" {yyTok = WEBKIT_DECLS_SYM; return yyTok; } 75 "@-webkit-value" {yyTok = WEBKIT_VALUE_SYM; return yyTok; } 76 "@-webkit-mediaquery" {BEGIN(mediaquery); yyTok = WEBKIT_MEDIAQUERY_SYM; return yyTok; } 77 "@-webkit-selector" {yyTok = WEBKIT_SELECTOR_SYM; return yyTok; } 78 "@-webkit-keyframes" {yyTok = WEBKIT_KEYFRAMES_SYM; return yyTok; } 79 "@-webkit-keyframe-rule" {yyTok = WEBKIT_KEYFRAME_RULE_SYM; return yyTok; } 80 81 "@"{ident} {yyTok = ATKEYWORD; return yyTok; } 82 83 "!"{w}"important" {yyTok = IMPORTANT_SYM; return yyTok;} 84 85 {num}em {yyTok = EMS; return yyTok;} 86 {num}rem {yyTok = REMS; return yyTok;} 87 {num}__qem {yyTok = QEMS; return yyTok;} /* quirky ems */ 88 {num}ex {yyTok = EXS; return yyTok;} 89 {num}px {yyTok = PXS; return yyTok;} 90 {num}cm {yyTok = CMS; return yyTok;} 91 {num}mm {yyTok = MMS; return yyTok;} 92 {num}in {yyTok = INS; return yyTok;} 93 {num}pt {yyTok = PTS; return yyTok;} 94 {num}pc {yyTok = PCS; return yyTok;} 95 {num}deg {yyTok = DEGS; return yyTok;} 96 {num}rad {yyTok = RADS; return yyTok;} 97 {num}grad {yyTok = GRADS; return yyTok;} 98 {num}turn {yyTok = TURNS; return yyTok;} 99 {num}ms {yyTok = MSECS; return yyTok;} 100 {num}s {yyTok = SECS; return yyTok;} 101 {num}Hz {yyTok = HERTZ; return yyTok;} 102 {num}kHz {yyTok = KHERTZ; return yyTok;} 103 {num}{ident} {yyTok = DIMEN; return yyTok;} 104 {num}{ident}\+ {yyTok = INVALIDDIMEN; return yyTok;} 105 {num}%+ {yyTok = PERCENTAGE; return yyTok;} 106 {intnum} {yyTok = INTEGER; return yyTok;} 107 {num} {yyTok = FLOATTOKEN; return yyTok;} 108 109 "-webkit-any(" {yyTok = ANYFUNCTION; return yyTok;} 110 "not(" {yyTok = NOTFUNCTION; return yyTok;} 111 "url("{w}{string}{w}")" {yyTok = URI; return yyTok;} 112 "url("{w}{url}{w}")" {yyTok = URI; return yyTok;} 113 "-webkit-calc(" {yyTok = CALCFUNCTION; return yyTok;} 114 "-webkit-min(" {yyTok = MINFUNCTION; return yyTok;} 115 "-webkit-max(" {yyTok = MAXFUNCTION; return yyTok;} 116 {ident}"(" {yyTok = FUNCTION; return yyTok;} 117 118 U\+{range} {yyTok = UNICODERANGE; return yyTok;} 119 U\+{h}{1,6}-{h}{1,6} {yyTok = UNICODERANGE; return yyTok;} 120 121 <mediaquery>"{" | 122 <mediaquery>";" {BEGIN(INITIAL); yyTok = *yytext; return yyTok; } 123 . {yyTok = *yytext; return yyTok;} 124 125 %% 126