1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include <precomp.h>
23 #include <s2_luidl/cx_sub.hxx>
24
25
26
27 // NOT FULLY DECLARED SERVICES
28 #include <s2_luidl/tokrecv.hxx>
29 #include <../../parser/inc/tokens/parseinc.hxx>
30 #include <x_parse2.hxx>
31 #include <s2_luidl/tk_const.hxx>
32
33
34
35 namespace csi
36 {
37 namespace uidl
38 {
39
40 bool
PassNewToken()41 Cx_Base::PassNewToken()
42 {
43 if (pNewToken)
44 {
45 rReceiver.Receive(*pNewToken.Release());
46 return true;
47 }
48 return false;
49 }
50
51 TkpContext &
FollowUpContext()52 Cx_Base::FollowUpContext()
53 {
54 csv_assert(pFollowUpContext != 0);
55 return *pFollowUpContext;
56 }
57
58 void
ReadCharChain(CharacterSource & io_rText)59 Context_MLComment::ReadCharChain( CharacterSource & io_rText )
60 {
61 char cNext = NULCH;
62
63 do {
64 do {
65 cNext = jumpTo(io_rText,'*','\n');
66 if (cNext == '\n')
67 {
68 Receiver().Increment_CurLine();
69 cNext = io_rText.MoveOn();
70 }
71 else if (cNext == NULCH)
72 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
73 } while (cNext != '*');
74
75 cNext = jumpOver(io_rText,'*');
76 if (cNext == NULCH)
77 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
78 } while (cNext != '/');
79 io_rText.MoveOn();
80 io_rText.CutToken();
81 SetToken(0);
82 }
83
84 void
ReadCharChain(CharacterSource & io_rText)85 Context_SLComment::ReadCharChain( CharacterSource & io_rText )
86 {
87 jumpToEol(io_rText);
88 if (io_rText.CurChar() != NULCH)
89 jumpOverEol(io_rText);
90 io_rText.CutToken();
91 SetToken(0);
92
93 Receiver().Increment_CurLine();
94 }
95
96 void
ReadCharChain(CharacterSource & io_rText)97 Context_Praeprocessor::ReadCharChain( CharacterSource & io_rText )
98 {
99 jumpToEol(io_rText);
100 if (io_rText.CurChar() != NULCH)
101 jumpOverEol(io_rText);
102 io_rText.CutToken();
103 SetToken(0);
104
105 Receiver().Increment_CurLine();
106 }
107
108 void
ReadCharChain(CharacterSource & io_rText)109 Context_Assignment::ReadCharChain( CharacterSource & io_rText )
110 {
111 // KORR_FUTURE
112 // How to handle new lines within this, so he y get realised by
113 // ParserInfo?
114
115 char cNext = NULCH;
116 do {
117 if ( (cNext = jumpTo(io_rText,';',',','"','}')) == NULCH )
118 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
119 if (cNext == '"')
120 {
121 cNext = io_rText.MoveOn();
122 while (cNext != '"')
123 {
124 if ( (cNext = jumpTo(io_rText,'"','\\')) == NULCH )
125 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF);
126 if (cNext == '\\')
127 io_rText.MoveOn();
128 }
129 cNext = io_rText.MoveOn();
130 } // endif (cNext == '"')
131 } while (cNext != ';' AND cNext != ',' AND cNext != '}');
132
133 if (cNext == ',' OR cNext == ';')
134 io_rText.MoveOn();
135 SetToken(new TokAssignment(io_rText.CutToken()));
136 }
137
138
139 } // namespace uidl
140 } // namespace csi
141