1%option case-insensitive 2%option noyywrap 3%option never-interactive 4 5%{ 6/* Lex source for CSS tokenizing. 7 Taken from http://www.w3.org/TR/CSS21/grammar.html#q2 8 Copyright (C) 2006, 2009 Free Software Foundation, Inc. 9 10This file is part of GNU Wget. 11 12GNU Wget is free software; you can redistribute it and/or modify 13it under the terms of the GNU General Public License as published by 14the Free Software Foundation; either version 3 of the License, or (at 15your option) any later version. 16 17GNU Wget is distributed in the hope that it will be useful, 18but WITHOUT ANY WARRANTY; without even the implied warranty of 19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20GNU General Public License for more details. 21 22You should have received a copy of the GNU General Public License 23along with Wget. If not, see <http://www.gnu.org/licenses/>. 24 25Additional permission under GNU GPL version 3 section 7 26 27If you modify this program, or any covered work, by linking or 28combining it with the OpenSSL project's OpenSSL library (or a 29modified version of that library), containing parts covered by the 30terms of the OpenSSL or SSLeay licenses, the Free Software Foundation 31grants you additional permission to convey the resulting work. 32Corresponding Source for a non-source form of such a combination 33shall include the source code for the parts of OpenSSL used as well 34as that of the covered work. */ 35 36#include "css-tokens.h" 37 38/* {s}+\/\*[^*]*\*+([^/*][^*]*\*+)*\/ {unput(' '); } */ 39/*replace by space*/ 40%} 41 42h [0-9a-f] 43nonascii [\200-\377] 44unicode \\{h}{1,6}(\r\n|[ \t\r\n\f])? 45escape {unicode}|\\[^\r\n\f0-9a-f] 46nmstart [_a-z]|{nonascii}|{escape} 47nmchar [_a-z0-9-]|{nonascii}|{escape} 48string1 \"([^\n\r\f\\"]|\\{nl}|{escape})*\" 49string2 \'([^\n\r\f\\']|\\{nl}|{escape})*\' 50invalid1 \"([^\n\r\f\\"]|\\{nl}|{escape})* 51invalid2 \'([^\n\r\f\\']|\\{nl}|{escape})* 52 53comment \/\*[^*]*\*+([^/*][^*]*\*+)*\/ 54ident -?{nmstart}{nmchar}* 55name {nmchar}+ 56num [0-9]+|[0-9]*"."[0-9]+ 57string {string1}|{string2} 58invalid {invalid1}|{invalid2} 59url ([!#$%&*-~]|{nonascii}|{escape})* 60s [ \t\r\n\f] 61w ({s}|{comment})* 62nl \n|\r\n|\r|\f 63 64A a|\\0{0,4}(41|61)(\r\n|[ \t\r\n\f])? 65C c|\\0{0,4}(43|63)(\r\n|[ \t\r\n\f])? 66D d|\\0{0,4}(44|64)(\r\n|[ \t\r\n\f])? 67E e|\\0{0,4}(45|65)(\r\n|[ \t\r\n\f])? 68G g|\\0{0,4}(47|67)(\r\n|[ \t\r\n\f])?|\\g 69H h|\\0{0,4}(48|68)(\r\n|[ \t\r\n\f])?|\\h 70I i|\\0{0,4}(49|69)(\r\n|[ \t\r\n\f])?|\\i 71K k|\\0{0,4}(4b|6b)(\r\n|[ \t\r\n\f])?|\\k 72M m|\\0{0,4}(4d|6d)(\r\n|[ \t\r\n\f])?|\\m 73N n|\\0{0,4}(4e|6e)(\r\n|[ \t\r\n\f])?|\\n 74P p|\\0{0,4}(50|70)(\r\n|[ \t\r\n\f])?|\\p 75R r|\\0{0,4}(52|72)(\r\n|[ \t\r\n\f])?|\\r 76S s|\\0{0,4}(53|73)(\r\n|[ \t\r\n\f])?|\\s 77T t|\\0{0,4}(54|74)(\r\n|[ \t\r\n\f])?|\\t 78X x|\\0{0,4}(58|78)(\r\n|[ \t\r\n\f])?|\\x 79Z z|\\0{0,4}(5a|7a)(\r\n|[ \t\r\n\f])?|\\z 80 81%% 82 83{s} {return S;} 84 85\/\*[^*]*\*+([^/*][^*]*\*+)*\/ {return S;} /* ignore comments */ 86 87"<!--" {return CDO;} 88"-->" {return CDC;} 89"~=" {return INCLUDES;} 90"|=" {return DASHMATCH;} 91 92{w}"{" {return LBRACE;} 93{w}"+" {return PLUS;} 94{w}">" {return GREATER;} 95{w}"," {return COMMA;} 96 97{string} {return STRING;} 98{invalid} {return INVALID; /* unclosed string */} 99 100{ident} {return IDENT;} 101 102"#"{name} {return HASH;} 103 104"@import" {return IMPORT_SYM;} 105"@page" {return PAGE_SYM;} 106"@media" {return MEDIA_SYM;} 107"@charset " {return CHARSET_SYM;} 108 109"!"{w}"important" {return IMPORTANT_SYM;} 110 111{num}{E}{M} {return EMS;} 112{num}{E}{X} {return EXS;} 113{num}{P}{X} {return LENGTH;} 114{num}{C}{M} {return LENGTH;} 115{num}{M}{M} {return LENGTH;} 116{num}{I}{N} {return LENGTH;} 117{num}{P}{T} {return LENGTH;} 118{num}{P}{C} {return LENGTH;} 119{num}{D}{E}{G} {return ANGLE;} 120{num}{R}{A}{D} {return ANGLE;} 121{num}{G}{R}{A}{D} {return ANGLE;} 122{num}{M}{S} {return TIME;} 123{num}{S} {return TIME;} 124{num}{H}{Z} {return FREQ;} 125{num}{K}{H}{Z} {return FREQ;} 126{num}{ident} {return DIMENSION;} 127 128{num}% {return PERCENTAGE;} 129{num} {return NUMBER;} 130 131"url("{w}{string}{w}")" {return URI;} 132"url("{w}{url}{w}")" {return URI;} 133{ident}"(" {return FUNCTION;} 134 135. {return *yytext;} 136 137%% 138