1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
21 #include "pagescanner.h"
30 Float [+-]?[0-9]*[.]?[0-9]*
35 IndirectRef {PlainInteger}{WhiteSpace}+{PlainInteger}{WhiteSpace}*"R"
36 IndirectDef {PlainInteger}{WhiteSpace}+{PlainInteger}{WhiteSpace}*"obj"
41 %option yyclass="PageScanner"
47 <Copy>(.|[\n]) { (*yyout) << *yytext ; }
49 ({Float}{WhiteSpace}+){5}{Float}{WhiteSpace}*"cm" {
52 dummy = strtod( yytext, & end );
55 throw( "Expected pure translation in the initial coordinate transform matrix" );
57 dummy = strtod( end, & end );
60 throw( "Expected pure translation in the initial coordinate transform matrix" );
62 dummy = strtod( end, & end );
65 throw( "Expected pure translation in the initial coordinate transform matrix" );
67 dummy = strtod( end, & end );
70 throw( "Expected pure translation in the initial coordinate transform matrix" );
72 x0 = strtod( end, & end );
73 y0 = strtod( end, & end );
74 (*yyout) << yytext << endl ;
80 {Float}{WhiteSpace}*"w" ;
90 {Float}{WhiteSpace}*{Float}{WhiteSpace}*"m" {
93 dummy = strtod( yytext, & end );
94 ytmp = strtod( end, & end );
97 {Float}{WhiteSpace}*{Float}{WhiteSpace}*"l" {
99 strtod( yytext, & end );
100 double tmp = strtod( end, & end ) - 3;
113 throw( "Surprising state in pagescanner" );
120 . { throw( string( "Page scanner found unrecognized token: " ) + yytext ); }
123 /* The closing %% above marks the end of the Rules section and the beginning
124 * of the User Subroutines section. All text from here to the end of the
125 * file is copied verbatim to the end of the generated lex.pdf.c file.
126 * This section is where you put definitions of helper functions.