Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "basiccharclass.hxx"
21 : : #include "sbcomp.hxx"
22 : :
23 : : #include <vcl/svapp.hxx>
24 : :
25 : 464 : SbiScanner::SbiScanner( const ::rtl::OUString& rBuf, StarBASIC* p ) : aBuf( rBuf )
26 : : {
27 : 464 : pBasic = p;
28 : 464 : pLine = NULL;
29 : 464 : nVal = 0;
30 : 464 : eScanType = SbxVARIANT;
31 : 464 : nErrors = 0;
32 : 464 : nBufPos = 0;
33 : 464 : nCurCol1 = 0;
34 : 464 : nSavedCol1 = 0;
35 : 464 : nColLock = 0;
36 : 464 : nLine = 0;
37 : 464 : nCol1 = 0;
38 : 464 : nCol2 = 0;
39 : 464 : nCol = 0;
40 : : bError =
41 : : bAbort =
42 : : bSpaces =
43 : : bNumber =
44 : : bSymbol =
45 : : bCompatible =
46 : : bVBASupportOn =
47 : : bInStatement =
48 : 464 : bPrevLineExtentsComment = false;
49 : 464 : bHash = true;
50 : 464 : }
51 : :
52 : 1501 : SbiScanner::~SbiScanner()
53 : 1501 : {}
54 : :
55 : 5250 : void SbiScanner::LockColumn()
56 : : {
57 [ + + ]: 5250 : if( !nColLock++ )
58 : 3565 : nSavedCol1 = nCol1;
59 : 5250 : }
60 : :
61 : 4682 : void SbiScanner::UnlockColumn()
62 : : {
63 [ + + ]: 4682 : if( nColLock )
64 : 3295 : nColLock--;
65 : 4682 : }
66 : :
67 : 18 : void SbiScanner::GenError( SbError code )
68 : : {
69 [ - + ]: 18 : if( GetSbData()->bBlockCompilerError )
70 : : {
71 : 0 : bAbort = true;
72 : 18 : return;
73 : : }
74 [ + - ]: 18 : if( !bError )
75 : : {
76 : 18 : bool bRes = true;
77 : : // report only one error per statement
78 : 18 : bError = true;
79 [ - + ]: 18 : if( pBasic )
80 : : {
81 : : // in case of EXPECTED or UNEXPECTED it always refers
82 : : // to the last token, so take the Col1 over
83 [ # # ]: 0 : sal_Int32 nc = nColLock ? nSavedCol1 : nCol1;
84 [ # # ]: 0 : switch( code )
85 : : {
86 : : case SbERR_EXPECTED:
87 : : case SbERR_UNEXPECTED:
88 : : case SbERR_SYMBOL_EXPECTED:
89 : : case SbERR_LABEL_EXPECTED:
90 : 0 : nc = nCol1;
91 [ # # ]: 0 : if( nc > nCol2 ) nCol2 = nc;
92 : 0 : break;
93 : : }
94 : 0 : bRes = pBasic->CError( code, aError, nLine, nc, nCol2 );
95 : : }
96 [ + - ][ + - ]: 18 : bAbort = bAbort || !bRes || ( code == SbERR_NO_MEMORY || code == SbERR_PROG_TOO_LARGE );
[ + - ][ - + ]
97 : : }
98 : 18 : nErrors++;
99 : : }
100 : :
101 : :
102 : : // used by SbiTokenizer::MayBeLabel() to detect a label
103 : 1622 : bool SbiScanner::DoesColonFollow()
104 : : {
105 [ + + ][ + + ]: 1622 : if(nCol < aLine.getLength() && aLine[nCol] == ':')
[ + + ]
106 : : {
107 : 16 : ++pLine; ++nCol;
108 : 16 : return true;
109 : : }
110 : : else
111 : 1622 : return false;
112 : : }
113 : :
114 : : // test for legal suffix
115 : 22376 : static SbxDataType GetSuffixType( sal_Unicode c )
116 : : {
117 [ + + + + : 22376 : switch (c)
+ + + ]
118 : : {
119 : : case '%':
120 : 413 : return SbxDataType(SbxINTEGER);
121 : : case '&':
122 : 6 : return SbxDataType(SbxLONG);
123 : : case '!':
124 : 3 : return SbxDataType(SbxSINGLE);
125 : : case '#':
126 : 3 : return SbxDataType(SbxDOUBLE);
127 : : case '@':
128 : 3 : return SbxDataType(SbxCURRENCY);
129 : : case '$':
130 : 63 : return SbxDataType(SbxSTRING);
131 : : default:
132 : 22376 : return SbxDataType(SbxVARIANT);
133 : : }
134 : : }
135 : :
136 : : // reading the next symbol into the variables aSym, nVal and eType
137 : : // return value is sal_False at EOF or errors
138 : : #define BUF_SIZE 80
139 : :
140 : 25439 : void SbiScanner::scanAlphanumeric()
141 : : {
142 : 25439 : sal_Int32 n = nCol;
143 [ + + ][ + + ]: 217101 : while(nCol < aLine.getLength() && (theBasicCharClass::get().isAlphaNumeric(aLine[nCol], bCompatible) || aLine[nCol] == '_'))
[ + + ][ + + ]
144 : : {
145 : 191662 : ++pLine;
146 : 191662 : ++nCol;
147 : : }
148 : 25439 : aSym = aLine.copy(n, nCol - n);
149 : 25439 : }
150 : :
151 : 3 : void SbiScanner::scanGoto()
152 : : {
153 : 3 : sal_Int32 n = nCol;
154 [ + - ][ + + ]: 9 : while(n < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[n]))
[ + + ]
155 : 6 : ++n;
156 : :
157 [ + - ]: 3 : if(n + 1 < aLine.getLength())
158 : : {
159 : 3 : ::rtl::OUString aTemp = aLine.copy(n, 2);
160 [ + - ]: 3 : if(aTemp.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("to")))
161 : : {
162 [ + - ]: 3 : aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("goto"));
163 : 3 : pLine += n + 2 - nCol;
164 : 3 : nCol = n + 2;
165 : 3 : }
166 : : }
167 : 3 : }
168 : :
169 : 10667 : bool SbiScanner::readLine()
170 : : {
171 [ + + ]: 10667 : if(nBufPos >= aBuf.getLength())
172 : 464 : return false;
173 : :
174 : 10203 : sal_Int32 n = nBufPos;
175 : 10203 : sal_Int32 nLen = aBuf.getLength();
176 : :
177 [ + + ][ + + ]: 337876 : while(n < nLen && aBuf[n] != '\r' && aBuf[n] != '\n')
[ + + ][ + + ]
178 : 327673 : ++n;
179 : :
180 : : // Trim trailing whitespace
181 : 10203 : sal_Int32 nEnd = n;
182 [ + + ][ + + ]: 11361 : while(nBufPos < nEnd && theBasicCharClass::get().isWhitespace(aBuf[nEnd - 1]))
[ + + ]
183 : 1158 : --nEnd;
184 : :
185 : 10203 : aLine = aBuf.copy(nBufPos, nEnd - nBufPos);
186 : :
187 : : // Fast-forward past the line ending
188 [ + + ][ + - ]: 10203 : if(n + 1 < nLen && aBuf[n] == '\r' && aBuf[n + 1] == '\n')
[ + + ][ + + ]
189 : 15 : n += 2;
190 [ + + ]: 10188 : else if(n < nLen)
191 : 9909 : ++n;
192 : :
193 : 10203 : nBufPos = n;
194 : 10203 : pLine = aLine.getStr();
195 : :
196 : 10203 : ++nLine;
197 : 10203 : nCol = nCol1 = nCol2 = 0;
198 : 10203 : nColLock = 0;
199 : :
200 : 10667 : return true;
201 : : }
202 : :
203 : 57193 : bool SbiScanner::NextSym()
204 : : {
205 : : // memorize for the EOLN-case
206 : 57193 : sal_Int32 nOldLine = nLine;
207 : 57193 : sal_Int32 nOldCol1 = nCol1;
208 : 57193 : sal_Int32 nOldCol2 = nCol2;
209 : 57193 : sal_Unicode buf[ BUF_SIZE ], *p = buf;
210 : :
211 : 57193 : eScanType = SbxVARIANT;
212 : 57193 : aSym = ::rtl::OUString();
213 : 57193 : bHash = bSymbol = bNumber = bSpaces = false;
214 : :
215 : : // read in line?
216 [ + + ]: 57193 : if( !pLine )
217 : : {
218 [ + - ][ + + ]: 10667 : if(!readLine())
219 : 464 : return false;
220 : :
221 : 10203 : nOldLine = nLine;
222 : 10203 : nOldCol1 = nOldCol2 = 0;
223 : : }
224 : :
225 [ + + ][ + - ]: 56729 : if(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol]))
[ + - ][ + + ]
[ + + ]
226 : : {
227 : 28484 : bSpaces = true;
228 [ + - ][ + - ]: 89606 : while(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol]))
[ + - ][ + + ]
[ + + ]
229 : 61122 : ++pLine, ++nCol;
230 : : }
231 : :
232 : 56729 : nCol1 = nCol;
233 : :
234 : : // only blank line?
235 [ + + ]: 56729 : if(nCol >= aLine.getLength())
236 : 9339 : goto eoln;
237 : :
238 [ - + ]: 47390 : if( bPrevLineExtentsComment )
239 : 0 : goto PrevLineCommentLbl;
240 : :
241 [ + - ][ + + ]: 47390 : if(nCol < aLine.getLength() && aLine[nCol] == '#')
[ + + ]
242 : : {
243 : 124 : ++pLine;
244 : 124 : ++nCol;
245 : 124 : bHash = true;
246 : : }
247 : :
248 : : // copy character if symbol
249 [ + - ][ + - ]: 47390 : if(nCol < aLine.getLength() && (theBasicCharClass::get().isAlpha(aLine[nCol], bCompatible) || aLine[nCol] == '_'))
[ + - ][ + + ]
[ + + ][ + + ]
250 : : {
251 : : // if there's nothing behind '_' , it's the end of a line!
252 [ + + ][ + + ]: 25545 : if(nCol + 1 == aLine.getLength() && aLine[nCol] == '_')
[ + + ]
253 : : {
254 : : // Note that nCol is not incremented here...
255 : 106 : ++pLine;
256 : 106 : goto eoln;
257 : : }
258 : :
259 : 25439 : bSymbol = true;
260 : :
261 [ + - ]: 25439 : scanAlphanumeric();
262 : :
263 : : // Special handling for "go to"
264 [ + + ][ + + ]: 25439 : if(nCol < aLine.getLength() && bCompatible && aSym.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("go")))
[ + + ][ + + ]
265 [ + - ]: 3 : scanGoto();
266 : :
267 : : // replace closing '_' by space when end of line is following
268 : : // (wrong line continuation otherwise)
269 [ + + ][ + + ]: 25439 : if(nCol == aLine.getLength() && aLine[nCol - 1] == '_' )
[ + + ]
270 : : {
271 : : // We are going to modify a potentially shared string, so force
272 : : // a copy, so that aSym is not modified by the following operation
273 : 3 : ::rtl::OUString aSymCopy( aSym.getStr(), aSym.getLength() );
274 : 3 : aSym = aSymCopy;
275 : :
276 : : // HACK: modifying a potentially shared string here!
277 : 3 : *((sal_Unicode*)(pLine-1)) = ' ';
278 : : }
279 : :
280 : : // type recognition?
281 : : // don't test the exclamation mark
282 : : // if there's a symbol behind it
283 [ + + ]: 25445 : else if((nCol >= aLine.getLength() || aLine[nCol] != '!') ||
[ + + + + ]
[ - + ][ + + ]
284 [ + - ][ + - ]: 9 : (nCol + 1 >= aLine.getLength() || !theBasicCharClass::get().isAlpha(aLine[nCol + 1], bCompatible)))
285 : : {
286 [ + + ]: 25433 : if(nCol < aLine.getLength())
287 : : {
288 : 20963 : SbxDataType t(GetSuffixType(aLine[nCol]));
289 [ + + ]: 20963 : if( t != SbxVARIANT )
290 : : {
291 : 491 : eScanType = t;
292 : 491 : ++pLine;
293 : 491 : ++nCol;
294 : : }
295 : : }
296 : : }
297 : : }
298 : :
299 : : // read in and convert if number
300 [ + - ][ + - ]: 62876 : else if((nCol < aLine.getLength() && theBasicCharClass::get().isDigit(aLine[nCol] & 0xFF)) ||
[ + - ][ + +
+ + + + ]
[ + + ][ + + ]
301 [ + - ][ + - ]: 41031 : (nCol + 1 < aLine.getLength() && aLine[nCol] == '.' && theBasicCharClass::get().isDigit(aLine[nCol + 1] & 0xFF)))
302 : : {
303 : 1413 : short exp = 0;
304 : 1413 : short comma = 0;
305 : 1413 : short ndig = 0;
306 : 1413 : short ncdig = 0;
307 : 1413 : eScanType = SbxDOUBLE;
308 : 1413 : bool bBufOverflow = false;
309 [ + + ][ + + ]: 3654 : while(nCol < aLine.getLength() && strchr("0123456789.DEde", aLine[nCol]))
[ + + ]
310 : : {
311 : : // from 4.1.1996: buffer full? -> go on scanning empty
312 [ + + ]: 2241 : if( (p-buf) == (BUF_SIZE-1) )
313 : : {
314 : 141 : bBufOverflow = true;
315 : 141 : ++pLine, ++nCol;
316 : 141 : continue;
317 : : }
318 : : // point or exponent?
319 [ + + ]: 2100 : if(aLine[nCol] == '.')
320 : : {
321 [ + + ]: 27 : if( ++comma > 1 )
322 : : {
323 : 3 : ++pLine; ++nCol; continue;
324 : : }
325 : : else
326 : : {
327 : 24 : *p = '.';
328 : 24 : ++p, ++pLine, ++nCol;
329 : : }
330 : : }
331 [ + + ]: 2073 : else if(strchr("DdEe", aLine[nCol]))
332 : : {
333 [ + + ]: 21 : if (++exp > 1)
334 : : {
335 : 3 : ++pLine; ++nCol; continue;
336 : : }
337 : :
338 : 18 : *p = 'E';
339 : 18 : ++p, ++pLine, ++nCol;
340 : :
341 [ + + ]: 18 : if(aLine[nCol] == '+')
342 : 6 : ++pLine, ++nCol;
343 [ + + ]: 12 : else if(aLine[nCol] == '-')
344 : : {
345 : 6 : *p = '-';
346 : 6 : ++p, ++pLine, ++nCol;
347 : : }
348 : : }
349 : : else
350 : : {
351 : 2052 : *p = aLine[nCol];
352 : 2052 : ++p, ++pLine, ++nCol;
353 [ + - ][ + + ]: 2052 : if( comma && !exp ) ++ncdig;
354 : : }
355 [ + + ]: 2094 : if (!exp) ++ndig;
356 : : }
357 : 1413 : *p = 0;
358 : 1413 : aSym = p; bNumber = true;
359 : :
360 [ + + ][ + + ]: 1413 : if( comma > 1 || exp > 1 )
361 : 6 : { aError = ::rtl::OUString('.');
362 [ + - ]: 6 : GenError( SbERR_BAD_CHAR_IN_NUMBER ); }
363 : :
364 : : // #57844 use localized function
365 : 1413 : nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',', NULL, NULL );
366 : :
367 : 1413 : ndig = ndig - comma;
368 [ + + ][ + + ]: 1413 : if( !comma && !exp )
369 : : {
370 [ + - ][ + + ]: 1371 : if( nVal >= SbxMININT && nVal <= SbxMAXINT )
371 : 1359 : eScanType = SbxINTEGER;
372 : : else
373 [ + - ][ + - ]: 12 : if( nVal >= SbxMINLNG && nVal <= SbxMAXLNG )
374 : 1371 : eScanType = SbxLONG;
375 : : }
376 [ + + ]: 1413 : if( bBufOverflow )
377 [ + - ]: 3 : GenError( SbERR_MATH_OVERFLOW );
378 : :
379 : : // type recognition?
380 : 1413 : SbxDataType t(GetSuffixType(aLine[nCol]));
381 [ - + ]: 1413 : if( t != SbxVARIANT )
382 : : {
383 : 0 : eScanType = t;
384 : 0 : ++pLine;
385 : 0 : ++nCol;
386 : : }
387 : : }
388 : :
389 : : // Hex/octal number? Read in and convert:
390 [ + - ][ + + ]: 20432 : else if(nCol < aLine.getLength() && aLine[nCol] == '&')
[ + + ]
391 : : {
392 : 339 : ++pLine; ++nCol;
393 : 339 : sal_Unicode cmp1[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F', 0 };
394 : 339 : sal_Unicode cmp2[] = { '0', '1', '2', '3', '4', '5', '6', '7', 0 };
395 : 339 : sal_Unicode *cmp = cmp1;
396 : 339 : sal_Unicode base = 16;
397 : 339 : sal_Unicode ndig = 8;
398 : 339 : sal_Unicode xch = aLine[nCol] & 0xFF;
399 : 339 : ++pLine; ++nCol;
400 [ + + + ]: 339 : switch( toupper( xch ) )
401 : : {
402 : : case 'O':
403 : 9 : cmp = cmp2; base = 8; ndig = 11; break;
404 : : case 'H':
405 : 18 : break;
406 : : default :
407 : : // treated as an operator
408 : 312 : --pLine; --nCol; nCol1 = nCol-1;
409 [ + - ]: 312 : aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&"));
410 : 312 : return true;
411 : : }
412 : 27 : bNumber = true;
413 : 27 : long l = 0;
414 : : int i;
415 : 27 : bool bBufOverflow = false;
416 [ + + ][ + - ]: 132 : while(nCol < aLine.getLength() && theBasicCharClass::get().isAlphaNumeric(aLine[nCol] & 0xFF, bCompatible))
[ + - ][ + + ]
[ + + ]
417 : : {
418 : : sal_Unicode ch = sal::static_int_cast< sal_Unicode >(
419 : 105 : toupper(aLine[nCol] & 0xFF));
420 : 105 : ++pLine; ++nCol;
421 : : // from 4.1.1996: buffer full, go on scanning empty
422 [ - + ]: 105 : if( (p-buf) == (BUF_SIZE-1) )
423 : 0 : bBufOverflow = true;
424 [ + + ]: 105 : else if( rtl::OUString( cmp ).indexOf( ch ) != -1 )
425 : 99 : *p++ = ch;
426 : : else
427 : : {
428 : 6 : aError = ::rtl::OUString(ch);
429 [ + - ]: 6 : GenError( SbERR_BAD_CHAR_IN_NUMBER );
430 : : }
431 : : }
432 : 27 : *p = 0;
433 [ + + ]: 87 : for( p = buf; *p; ++p )
434 : : {
435 : 63 : i = (*p & 0xFF) - '0';
436 [ + + ]: 63 : if( i > 9 ) i -= 7;
437 : 63 : l = ( l * base ) + i;
438 [ + + ]: 63 : if( !ndig-- )
439 : : {
440 [ + - ]: 3 : GenError( SbERR_MATH_OVERFLOW ); break;
441 : : }
442 : : }
443 [ + + ][ + + ]: 27 : if(nCol < aLine.getLength() && aLine[nCol] == '&') ++pLine, ++nCol;
[ + + ]
444 : 27 : nVal = (double) l;
445 [ + + ][ + - ]: 27 : eScanType = ( l >= SbxMININT && l <= SbxMAXINT ) ? SbxINTEGER : SbxLONG;
446 [ - + ]: 27 : if( bBufOverflow )
447 [ # # ]: 27 : GenError( SbERR_MATH_OVERFLOW );
448 : : }
449 : :
450 : : // Strings:
451 [ + + ][ - + ]: 20093 : else if( *pLine == '"' || *pLine == '[' )
452 : : {
453 : 2685 : sal_Unicode cSep = *pLine;
454 [ - + ]: 2685 : if( cSep == '[' )
455 : 0 : bSymbol = true, cSep = ']';
456 : 2685 : sal_Int32 n = nCol + 1;
457 [ + - ]: 2781 : while( *pLine )
458 : : {
459 [ + - ][ + + ]: 39369 : do pLine++, nCol++;
[ + + ]
460 : : while( *pLine && ( *pLine != cSep ) );
461 [ + - ]: 2781 : if( *pLine == cSep )
462 : : {
463 : 2781 : pLine++; nCol++;
464 [ + + ][ - + ]: 2781 : if( *pLine != cSep || cSep == ']' ) break;
465 [ # # ]: 0 : } else aError = ::rtl::OUString(cSep), GenError( SbERR_EXPECTED );
466 : : }
467 : : // If VBA Interop then doen't eat the [] chars
468 [ - + ][ # # ]: 2685 : if ( cSep == ']' && bVBASupportOn )
469 : 0 : aSym = aLine.copy( n - 1, nCol - n + 1);
470 : : else
471 : 2685 : aSym = aLine.copy( n, nCol - n - 1 );
472 : : // get out duplicate string delimiters
473 : 2685 : ::rtl::OUStringBuffer aSymBuf;
474 [ + + ]: 39369 : for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i )
475 : : {
476 [ + - ]: 36684 : aSymBuf.append( aSym[i] );
477 [ + + ][ + - ]: 36684 : if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep )
[ + - ][ + + ]
478 : 96 : ++i;
479 : : }
480 [ + - ]: 2685 : aSym = aSymBuf.makeStringAndClear();
481 [ + - ]: 2685 : if( cSep != ']' )
482 [ - + ]: 2685 : eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
483 : : }
484 : : // invalid characters:
485 [ - + ]: 17408 : else if( ( *pLine & 0xFF ) >= 0x7F )
486 : : {
487 [ # # ]: 0 : GenError( SbERR_SYNTAX ); pLine++; nCol++;
488 : : }
489 : : // other groups:
490 : : else
491 : : {
492 : 17408 : sal_Int32 n = 1;
493 [ + + + + ]: 17408 : switch( *pLine++ )
494 : : {
495 [ + + ][ + + ]: 70 : case '<': if( *pLine == '>' || *pLine == '=' ) n = 2; break;
496 [ + + ]: 12 : case '>': if( *pLine == '=' ) n = 2; break;
497 [ + + ]: 170 : case ':': if( *pLine == '=' ) n = 2; break;
498 : : }
499 : 17408 : aSym = aLine.copy( nCol, n );
500 : 17408 : pLine += n-1; nCol = nCol + n;
501 : : }
502 : :
503 : 46972 : nCol2 = nCol-1;
504 : :
505 : : PrevLineCommentLbl:
506 : :
507 [ + - ][ + + : 134873 : if( bPrevLineExtentsComment || (eScanType != SbxSTRING &&
+ + + + ]
[ + + ]
508 : 87901 : ( aSym[0] == '\'' || aSym.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("REM") ) ) ) )
509 : : {
510 : 758 : bPrevLineExtentsComment = false;
511 [ + - ]: 758 : aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REM"));
512 : 758 : sal_Int32 nLen = rtl_ustr_getLength(pLine);
513 [ - + ][ # # ]: 758 : if( bCompatible && pLine[ nLen - 1 ] == '_' && pLine[ nLen - 2 ] == ' ' )
[ + + ]
514 : 0 : bPrevLineExtentsComment = true;
515 : 758 : nCol2 = nCol2 + nLen;
516 : 758 : pLine = NULL;
517 : : }
518 : 46972 : return true;
519 : :
520 : :
521 : : eoln:
522 [ + + ][ + + ]: 9445 : if( nCol && *--pLine == '_' )
[ + + ]
523 : : {
524 : 106 : pLine = NULL;
525 [ + - ]: 106 : bool bRes = NextSym();
526 [ + + ][ - + ]: 106 : if( bVBASupportOn && aSym[0] == '.' )
[ - + ]
527 : : {
528 : : // object _
529 : : // .Method
530 : : // ^^^ <- spaces is legal in MSO VBA
531 : : OSL_TRACE("*** resetting bSpaces***");
532 : 0 : bSpaces = false;
533 : : }
534 : 106 : return bRes;
535 : : }
536 : : else
537 : : {
538 : 9339 : pLine = NULL;
539 : 9339 : nLine = nOldLine;
540 : 9339 : nCol1 = nOldCol1;
541 : 9339 : nCol2 = nOldCol2;
542 [ + - ]: 9339 : aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n"));
543 : 9339 : nColLock = 0;
544 : 57193 : return true;
545 : : }
546 : : }
547 : :
548 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|