From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kdeprint/ppdscanner.l | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 kdeprint/ppdscanner.l (limited to 'kdeprint/ppdscanner.l') diff --git a/kdeprint/ppdscanner.l b/kdeprint/ppdscanner.l new file mode 100644 index 000000000..b71edcd89 --- /dev/null +++ b/kdeprint/ppdscanner.l @@ -0,0 +1,141 @@ +%{ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001-2003 Michael Goffioul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + **/ + +#include +#include +#define YYSTYPE QStringList +#include "ppdparser.cpp.h" + +#define yylval kdeprint_ppdlval + +QIODevice *kdeprint_ppdscanner_device = NULL; +#define YY_INPUT(buf,result,max_size) \ + { \ + if (kdeprint_ppdscanner_device) \ + { \ + result = kdeprint_ppdscanner_device->readBlock(buf,max_size); \ + if (result < 0) \ + result = 0; \ + } \ + else \ + result = 0; \ + } +int kdeprint_ppdscanner_lno = 0; + +#if 0 +#define QDEBUG0(s) qDebug(s) +#define QDEBUG1(s,a) qDebug(s,a) +#else +#define QDEBUG0(s) +#define QDEBUG1(s,a) +#endif +%} + +%x option value translation_1 translation_2 constr +%option noyywrap + +WORD [^:/\x00-\x20\x7F-\xFF]+ +WORD2 [^:/\x00-\x20\x7F-\xFF\*]+ +WORD3 [^:/\x00-\x20\x7F-\xFF][^:/\x00-\x1F\x7F-\xFF]* +L [[:alnum:]] + +%% + + /** + * Initial state + */ +\*"JCLOpenUI" | +\*"OpenUI"{L}* { QDEBUG0("Open UI"); BEGIN(option); return OPENUI; } +\*"JCLCloseUI" | +\*"CloseUI"{L}* { QDEBUG0("Close UI"); BEGIN(value); return CLOSEUI; } +\*"OpenGroup" { QDEBUG0("Open group"); BEGIN(option); return OPENGROUP; } +\*"CloseGroup" { QDEBUG0("Close group"); BEGIN(option); return CLOSEGROUP; } +\*"Default"\*{WORD} { yylval = yytext+9; BEGIN(option); return DEFAULT; } +\*"Default"{WORD} { yylval = yytext+8; BEGIN(option); return DEFAULT; } +\*"UIConstraints" | +\*"NonUIConstraints" { BEGIN(constr); return CONSTRAINT; } +\*"PaperDimension" { BEGIN(option); return PAPERDIM; } +\*"ImageableArea" { BEGIN(option); return IMGAREA; } +\*"End" { /* eat up */ } + +"*% COMDATA #".*$ { yylval = yytext+12; return FOODATA; } +\*%.* { QDEBUG0("Comment"); return COMMENT; } +\*{WORD} { yylval = yytext+1; QDEBUG1("Main keyword: %s",yytext+1); BEGIN(option); return KEYWORD; } + + /** + * Option state + */ +