summaryrefslogtreecommitdiffstats
path: root/khtml/css/tokenizer.flex
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /khtml/css/tokenizer.flex
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khtml/css/tokenizer.flex')
-rw-r--r--khtml/css/tokenizer.flex92
1 files changed, 92 insertions, 0 deletions
diff --git a/khtml/css/tokenizer.flex b/khtml/css/tokenizer.flex
new file mode 100644
index 000000000..3c24d8e07
--- /dev/null
+++ b/khtml/css/tokenizer.flex
@@ -0,0 +1,92 @@
+%option case-insensitive
+%option noyywrap
+%option 8bit
+
+h [0-9a-fA-F]
+nonascii [\200-\377]
+unicode \\{h}{1,6}[ \t\r\n\f]?
+escape {unicode}|\\[ -~\200-\377]
+nmstart [_a-zA-Z]|{nonascii}|{escape}
+nmchar [_a-zA-Z0-9-]|{nonascii}|{escape}
+string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
+string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
+
+ident -?{nmstart}{nmchar}*
+name {nmchar}+
+num [0-9]+|[0-9]*"."[0-9]+
+intnum [0-9]+
+string {string1}|{string2}
+url ([!#$%&*-~]|{nonascii}|{escape})*
+w [ \t\r\n\f]*
+nl \n|\r\n|\r|\f
+range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))
+nth (-?[0-9]*n[\+-][0-9]+)|(-?[0-9]*n)
+
+%%
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/ /* ignore comments */
+
+[ \t\r\n\f]+ {yyTok = S; return yyTok;}
+
+"<!--" {yyTok = SGML_CD; return yyTok;}
+"-->" {yyTok = SGML_CD; return yyTok;}
+"~=" {yyTok = INCLUDES; return yyTok;}
+"|=" {yyTok = DASHMATCH; return yyTok;}
+"^=" {yyTok = BEGINSWITH; return yyTok;}
+"$=" {yyTok = ENDSWITH; return yyTok;}
+"*=" {yyTok = CONTAINS; return yyTok;}
+
+{string} {yyTok = STRING; return yyTok;}
+
+{ident} {yyTok = IDENT; return yyTok;}
+
+{nth} {yyTok = NTH; return yyTok;}
+
+"#"{name} {yyTok = HASH; return yyTok;}
+
+"@import" {yyTok = IMPORT_SYM; return yyTok;}
+"@page" {yyTok = PAGE_SYM; return yyTok;}
+"@media" {yyTok = MEDIA_SYM; return yyTok;}
+"@font-face" {yyTok = FONT_FACE_SYM; return yyTok;}
+"@charset" {yyTok = CHARSET_SYM; return yyTok;}
+"@namespace" {yyTok = NAMESPACE_SYM; return yyTok; }
+"@-khtml-rule" {yyTok = KHTML_RULE_SYM; return yyTok; }
+"@-khtml-decls" {yyTok = KHTML_DECLS_SYM; return yyTok; }
+"@-khtml-value" {yyTok = KHTML_VALUE_SYM; return yyTok; }
+
+"!"{w}"important" {yyTok = IMPORTANT_SYM; return yyTok;}
+
+{num}em {yyTok = EMS; return yyTok;}
+{num}__qem {yyTok = QEMS; return yyTok;} /* quirky ems */
+{num}ex {yyTok = EXS; return yyTok;}
+{num}px {yyTok = PXS; return yyTok;}
+{num}cm {yyTok = CMS; return yyTok;}
+{num}mm {yyTok = MMS; return yyTok;}
+{num}in {yyTok = INS; return yyTok;}
+{num}pt {yyTok = PTS; return yyTok;}
+{num}pc {yyTok = PCS; return yyTok;}
+{num}deg {yyTok = DEGS; return yyTok;}
+{num}rad {yyTok = RADS; return yyTok;}
+{num}grad {yyTok = GRADS; return yyTok;}
+{num}ms {yyTok = MSECS; return yyTok;}
+{num}s {yyTok = SECS; return yyTok;}
+{num}Hz {yyTok = HERZ; return yyTok;}
+{num}kHz {yyTok = KHERZ; return yyTok;}
+{num}{ident} {yyTok = DIMEN; return yyTok;}
+{num}% {yyTok = PERCENTAGE; return yyTok;}
+{intnum} {yyTok = INTEGER; return yyTok;}
+{num} {yyTok = FLOAT; return yyTok;}
+
+
+"not(" {yyTok = NOTFUNCTION; return yyTok;}
+"url("{w}{string}{w}")" {yyTok = URI; return yyTok;}
+"url("{w}{url}{w}")" {yyTok = URI; return yyTok;}
+{ident}"(" {yyTok = FUNCTION; return yyTok;}
+
+U\+{range} {yyTok = UNICODERANGE; return yyTok;}
+U\+{h}{1,6}-{h}{1,6} {yyTok = UNICODERANGE; return yyTok;}
+
+. {yyTok = *yytext; return yyTok;}
+
+%%
+