1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include <s2_luidl/cx_sub.hxx>
30 
31 
32 
33 // NOT FULLY DECLARED SERVICES
34 #include <s2_luidl/tokrecv.hxx>
35 #include <../../parser/inc/tokens/parseinc.hxx>
36 #include <x_parse2.hxx>
37 #include <s2_luidl/tk_const.hxx>
38 
39 
40 
41 namespace csi
42 {
43 namespace uidl
44 {
45 
46 bool
47 Cx_Base::PassNewToken()
48 {
49 	if (pNewToken)
50 	{
51 		rReceiver.Receive(*pNewToken.Release());
52 		return true;
53 	}
54 	return false;
55 }
56 
57 TkpContext &
58 Cx_Base::FollowUpContext()
59 {
60 	csv_assert(pFollowUpContext != 0);
61 	return *pFollowUpContext;
62 }
63 
64 void
65 Context_MLComment::ReadCharChain( CharacterSource &	io_rText )
66 {
67 	char cNext = NULCH;
68 
69 	do {
70 	    do {
71 	        cNext = jumpTo(io_rText,'*','\n');
72 	        if (cNext == '\n')
73             {
74                 Receiver().Increment_CurLine();
75                 cNext = io_rText.MoveOn();
76             }
77 	        else if (cNext == NULCH)
78     			throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
79         } while (cNext != '*');
80 
81 		cNext = jumpOver(io_rText,'*');
82 		if (cNext == NULCH)
83 			throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
84 	} while (cNext != '/');
85 	io_rText.MoveOn();
86 	io_rText.CutToken();
87 	SetToken(0);
88 }
89 
90 void
91 Context_SLComment::ReadCharChain( CharacterSource &	io_rText )
92 {
93 	jumpToEol(io_rText);
94 	if (io_rText.CurChar() != NULCH)
95 		jumpOverEol(io_rText);
96 	io_rText.CutToken();
97 	SetToken(0);
98 
99     Receiver().Increment_CurLine();
100 }
101 
102 void
103 Context_Praeprocessor::ReadCharChain( CharacterSource &	io_rText )
104 {
105 	jumpToEol(io_rText);
106 	if (io_rText.CurChar() != NULCH)
107 		jumpOverEol(io_rText);
108 	io_rText.CutToken();
109 	SetToken(0);
110 
111     Receiver().Increment_CurLine();
112 }
113 
114 void
115 Context_Assignment::ReadCharChain( CharacterSource &	io_rText )
116 {
117     // KORR_FUTURE
118     // How to handle new lines within this, so he y get realised by
119     //  ParserInfo?
120 
121 	char cNext = NULCH;
122 	do {
123 		if ( (cNext = jumpTo(io_rText,';',',','"','}')) == NULCH )
124 			throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
125 		if (cNext == '"')
126 		{
127 			cNext = io_rText.MoveOn();
128 			while (cNext != '"')
129 			{
130 				if ( (cNext = jumpTo(io_rText,'"','\\')) == NULCH )
131 					throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
132 				if (cNext == '\\')
133 					io_rText.MoveOn();
134 			}
135 			cNext = io_rText.MoveOn();
136 		}	// endif (cNext == '"')
137 	} while (cNext != ';' AND cNext != ',' AND cNext != '}');
138 
139 	if (cNext == ',' OR cNext == ';')
140 		io_rText.MoveOn();
141 	SetToken(new TokAssignment(io_rText.CutToken()));
142 }
143 
144 
145 }   // namespace uidl
146 }   // namespace csi
147