1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cx_c_sub.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include "cx_c_sub.hxx"
36 // NOT FULLY DECLARED SERVICES
38 #include "c_dealer.hxx"
39 #include <tokens/parseinc.hxx>
40 #include <x_parse.hxx>
41 #include "all_toks.hxx"
49 Context_Comment::ReadCharChain( CharacterSource
& io_rText
)
52 // Counting of lines must be implemented.
53 if (bCurrentModeIsMultiline
)
59 cNext
= jumpTo( io_rText
,'*',char(10) );
61 throw X_Parser( X_Parser::x_UnexpectedEOF
, "", String::Null_(), 0 );
62 else if ( cNext
== char(10) )
64 jumpOverEol(io_rText
);
67 } while ( cNext
!= '*');
68 cNext
= jumpOver(io_rText
,'*');
70 throw X_Parser( X_Parser::x_UnexpectedEOF
, "", String::Null_(), 0 );
71 } while (cNext
!= '/');
78 int o_rCount_BackslashedLineBreaks
= 0;
79 jumpToEol(io_rText
,o_rCount_BackslashedLineBreaks
);
80 for ( ; o_rCount_BackslashedLineBreaks
> 0; --o_rCount_BackslashedLineBreaks
)
83 if (io_rText
.CurChar() != NULCH
)
84 jumpOverEol(io_rText
);
93 Context_ConstString::ReadCharChain( CharacterSource
& io_rText
)
95 char cNext
= io_rText
.MoveOn();
98 { // Get one complete string constant: "...."
99 while (cNext
!= '"' AND cNext
!= '\\')
100 { // Get string till next '\\'
101 cNext
= io_rText
.MoveOn();
106 cNext
= io_rText
.MoveOn();
110 SetNewToken(new Tok_Constant(io_rText
.CutToken()));
114 Context_ConstChar::ReadCharChain( CharacterSource
& io_rText
)
116 char cNext
= io_rText
.MoveOn();
118 while (cNext
!= '\'')
119 { // Get one complete char constant: "...."
120 while (cNext
!= '\'' AND cNext
!= '\\')
121 { // Get string till next '\\'
122 cNext
= io_rText
.MoveOn();
127 cNext
= io_rText
.MoveOn();
131 SetNewToken(new Tok_Constant(io_rText
.CutToken()));
135 Context_ConstNumeric::ReadCharChain(CharacterSource
& io_rText
)
141 cNext
= static_cast<char>( tolower(io_rText
.MoveOn()) );
142 } while ( (cNext
!= 'e' AND
isalnum(cNext
)) OR cNext
== '.');
145 cNext
= io_rText
.MoveOn();
146 if (cNext
== '+' OR cNext
== '-')
147 cNext
= io_rText
.MoveOn();
149 } while (isalnum(cNext
) OR cNext
== '.'); // Reicht aus, wenn Zahlen korrekt geschrieben sind
150 SetNewToken(new Tok_Constant(io_rText
.CutToken()));
154 Context_UnblockMacro::ReadCharChain(CharacterSource
& io_rText
)
156 jumpToWhite(io_rText
);
157 SetNewToken(new Tok_UnblockMacro( io_rText
.CutToken() + strlen("#unblock-") ));