]> sjero.net Git - wget/blob - src/css.l
Mass update copyright years.
[wget] / src / css.l
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, 2010 Free Software Foundation, Inc.
9
10 This file is part of GNU Wget.
11
12 GNU Wget is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or (at
15 your option) any later version.
16
17 GNU Wget is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with Wget.  If not, see <http://www.gnu.org/licenses/>.
24
25 Additional permission under GNU GPL version 3 section 7
26
27 If you modify this program, or any covered work, by linking or
28 combining it with the OpenSSL project's OpenSSL library (or a
29 modified version of that library), containing parts covered by the
30 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
31 grants you additional permission to convey the resulting work.
32 Corresponding Source for a non-source form of such a combination
33 shall include the source code for the parts of OpenSSL used as well
34 as that of the covered work.  */
35
36 #include "css-tokens.h"
37
38 /* {s}+\/\*[^*]*\*+([^/*][^*]*\*+)*\/      {unput(' '); } */
39 /*replace by space*/
40 %}
41
42 h               [0-9a-f]
43 nonascii        [\200-\377]
44 unicode         \\{h}{1,6}(\r\n|[ \t\r\n\f])?
45 escape          {unicode}|\\[^\r\n\f0-9a-f]
46 nmstart         [_a-z]|{nonascii}|{escape}
47 nmchar          [_a-z0-9-]|{nonascii}|{escape}
48 string1         \"([^\n\r\f\\"]|\\{nl}|{escape})*\"
49 string2         \'([^\n\r\f\\']|\\{nl}|{escape})*\'
50 invalid1        \"([^\n\r\f\\"]|\\{nl}|{escape})*
51 invalid2        \'([^\n\r\f\\']|\\{nl}|{escape})*
52
53 comment         \/\*[^*]*\*+([^/*][^*]*\*+)*\/
54 ident           -?{nmstart}{nmchar}*
55 name            {nmchar}+
56 num             [0-9]+|[0-9]*"."[0-9]+
57 string          {string1}|{string2}
58 invalid         {invalid1}|{invalid2}
59 url             ([!#$%&*-~]|{nonascii}|{escape})*
60 s               [ \t\r\n\f]
61 w               ({s}|{comment})*
62 nl              \n|\r\n|\r|\f
63
64 A               a|\\0{0,4}(41|61)(\r\n|[ \t\r\n\f])?
65 C               c|\\0{0,4}(43|63)(\r\n|[ \t\r\n\f])?
66 D               d|\\0{0,4}(44|64)(\r\n|[ \t\r\n\f])?
67 E               e|\\0{0,4}(45|65)(\r\n|[ \t\r\n\f])?
68 G               g|\\0{0,4}(47|67)(\r\n|[ \t\r\n\f])?|\\g
69 H               h|\\0{0,4}(48|68)(\r\n|[ \t\r\n\f])?|\\h
70 I               i|\\0{0,4}(49|69)(\r\n|[ \t\r\n\f])?|\\i
71 K               k|\\0{0,4}(4b|6b)(\r\n|[ \t\r\n\f])?|\\k
72 M               m|\\0{0,4}(4d|6d)(\r\n|[ \t\r\n\f])?|\\m
73 N               n|\\0{0,4}(4e|6e)(\r\n|[ \t\r\n\f])?|\\n
74 P               p|\\0{0,4}(50|70)(\r\n|[ \t\r\n\f])?|\\p
75 R               r|\\0{0,4}(52|72)(\r\n|[ \t\r\n\f])?|\\r
76 S               s|\\0{0,4}(53|73)(\r\n|[ \t\r\n\f])?|\\s
77 T               t|\\0{0,4}(54|74)(\r\n|[ \t\r\n\f])?|\\t
78 X               x|\\0{0,4}(58|78)(\r\n|[ \t\r\n\f])?|\\x
79 Z               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 %%