Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / cx_c_sub.cxx
blob5dcca6fe1a5c1e61027243d330b122d67e8f0695
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cx_c_sub.cxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
31 #include <precomp.h>
32 #include "cx_c_sub.hxx"
36 // NOT FULLY DECLARED SERVICES
37 #include <ctype.h>
38 #include "c_dealer.hxx"
39 #include <tokens/parseinc.hxx>
40 #include <x_parse.hxx>
41 #include "all_toks.hxx"
44 namespace cpp {
48 void
49 Context_Comment::ReadCharChain( CharacterSource & io_rText )
51 // KORR_FUTURE
52 // Counting of lines must be implemented.
53 if (bCurrentModeIsMultiline)
55 char cNext = NULCH;
57 do {
58 do {
59 cNext = jumpTo( io_rText,'*',char(10) );
60 if (cNext == NULCH)
61 throw X_Parser( X_Parser::x_UnexpectedEOF, "", String::Null_(), 0 );
62 else if ( cNext == char(10) )
64 jumpOverEol(io_rText);
65 Dealer().Deal_Eol();
67 } while ( cNext != '*');
68 cNext = jumpOver(io_rText,'*');
69 if (cNext == NULCH)
70 throw X_Parser( X_Parser::x_UnexpectedEOF, "", String::Null_(), 0 );
71 } while (cNext != '/');
72 io_rText.MoveOn();
73 io_rText.CutToken();
74 SetNewToken(0);
76 else //
78 int o_rCount_BackslashedLineBreaks = 0;
79 jumpToEol(io_rText,o_rCount_BackslashedLineBreaks);
80 for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks )
81 Dealer().Deal_Eol();
83 if (io_rText.CurChar() != NULCH)
84 jumpOverEol(io_rText);
85 io_rText.CutToken();
86 Dealer().Deal_Eol();
87 SetNewToken(0);
88 } // endif
92 void
93 Context_ConstString::ReadCharChain( CharacterSource & io_rText )
95 char cNext = io_rText.MoveOn();
97 while (cNext != '"')
98 { // Get one complete string constant: "...."
99 while (cNext != '"' AND cNext != '\\')
100 { // Get string till next '\\'
101 cNext = io_rText.MoveOn();
103 if (cNext == '\\')
105 io_rText.MoveOn();
106 cNext = io_rText.MoveOn();
109 io_rText.MoveOn();
110 SetNewToken(new Tok_Constant(io_rText.CutToken()));
113 void
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();
124 if (cNext == '\\')
126 io_rText.MoveOn();
127 cNext = io_rText.MoveOn();
130 io_rText.MoveOn();
131 SetNewToken(new Tok_Constant(io_rText.CutToken()));
134 void
135 Context_ConstNumeric::ReadCharChain(CharacterSource & io_rText)
137 char cNext = 0;
139 do {
140 do {
141 cNext = static_cast<char>( tolower(io_rText.MoveOn()) );
142 } while ( (cNext != 'e' AND isalnum(cNext)) OR cNext == '.');
143 if (cNext == 'e')
145 cNext = io_rText.MoveOn();
146 if (cNext == '+' OR cNext == '-')
147 cNext = io_rText.MoveOn();
148 } // endif
149 } while (isalnum(cNext) OR cNext == '.'); // Reicht aus, wenn Zahlen korrekt geschrieben sind
150 SetNewToken(new Tok_Constant(io_rText.CutToken()));
153 void
154 Context_UnblockMacro::ReadCharChain(CharacterSource & io_rText)
156 jumpToWhite(io_rText);
157 SetNewToken(new Tok_UnblockMacro( io_rText.CutToken() + strlen("#unblock-") ));
160 } // namespace cpp