Update ooo320-m1
[ooovba.git] / autodoc / source / parser_i / idl / cx_sub.cxx
blob4bb1868bb91fcc0f4f2af132d1bfca1c4697952d
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_sub.cxx,v $
10 * $Revision: 1.6 $
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 <s2_luidl/cx_sub.hxx>
36 // NOT FULLY DECLARED SERVICES
37 #include <s2_luidl/tokrecv.hxx>
38 #include <../../parser/inc/tokens/parseinc.hxx>
39 #include <x_parse2.hxx>
40 #include <s2_luidl/tk_const.hxx>
44 namespace csi
46 namespace uidl
49 bool
50 Cx_Base::PassNewToken()
52 if (pNewToken)
54 rReceiver.Receive(*pNewToken.Release());
55 return true;
57 return false;
60 TkpContext &
61 Cx_Base::FollowUpContext()
63 csv_assert(pFollowUpContext != 0);
64 return *pFollowUpContext;
67 void
68 Context_MLComment::ReadCharChain( CharacterSource & io_rText )
70 char cNext = NULCH;
72 do {
73 do {
74 cNext = jumpTo(io_rText,'*','\n');
75 if (cNext == '\n')
77 Receiver().Increment_CurLine();
78 cNext = io_rText.MoveOn();
80 else if (cNext == NULCH)
81 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
82 } while (cNext != '*');
84 cNext = jumpOver(io_rText,'*');
85 if (cNext == NULCH)
86 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
87 } while (cNext != '/');
88 io_rText.MoveOn();
89 io_rText.CutToken();
90 SetToken(0);
93 void
94 Context_SLComment::ReadCharChain( CharacterSource & io_rText )
96 jumpToEol(io_rText);
97 if (io_rText.CurChar() != NULCH)
98 jumpOverEol(io_rText);
99 io_rText.CutToken();
100 SetToken(0);
102 Receiver().Increment_CurLine();
105 void
106 Context_Praeprocessor::ReadCharChain( CharacterSource & io_rText )
108 jumpToEol(io_rText);
109 if (io_rText.CurChar() != NULCH)
110 jumpOverEol(io_rText);
111 io_rText.CutToken();
112 SetToken(0);
114 Receiver().Increment_CurLine();
117 void
118 Context_Assignment::ReadCharChain( CharacterSource & io_rText )
120 // KORR_FUTURE
121 // How to handle new lines within this, so he y get realised by
122 // ParserInfo?
124 char cNext = NULCH;
125 do {
126 if ( (cNext = jumpTo(io_rText,';',',','"','}')) == NULCH )
127 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
128 if (cNext == '"')
130 cNext = io_rText.MoveOn();
131 while (cNext != '"')
133 if ( (cNext = jumpTo(io_rText,'"','\\')) == NULCH )
134 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
135 if (cNext == '\\')
136 io_rText.MoveOn();
138 cNext = io_rText.MoveOn();
139 } // endif (cNext == '"')
140 } while (cNext != ';' AND cNext != ',' AND cNext != '}');
142 if (cNext == ',' OR cNext == ';')
143 io_rText.MoveOn();
144 SetToken(new TokAssignment(io_rText.CutToken()));
148 } // namespace uidl
149 } // namespace csi