1*1c78a5d6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1c78a5d6SAndrew Rist * distributed with this work for additional information 6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance 9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an 15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the 17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations 18*1c78a5d6SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*1c78a5d6SAndrew Rist *************************************************************/ 21*1c78a5d6SAndrew Rist 22*1c78a5d6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ADC_PARSEINC_HXX 25cdf0e10cSrcweir #define ADC_PARSEINC_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/tkpchars.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir inline char 31cdf0e10cSrcweir jumpOver( CharacterSource & io_rText, 32cdf0e10cSrcweir char in_c ) 33cdf0e10cSrcweir { 34cdf0e10cSrcweir char cNext; 35cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 36cdf0e10cSrcweir cNext == in_c; 37cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 38cdf0e10cSrcweir { } 39cdf0e10cSrcweir 40cdf0e10cSrcweir return cNext; 41cdf0e10cSrcweir } 42cdf0e10cSrcweir 43cdf0e10cSrcweir inline char 44cdf0e10cSrcweir jumpTo( CharacterSource & io_rText, 45cdf0e10cSrcweir char in_c ) 46cdf0e10cSrcweir { 47cdf0e10cSrcweir char cNext; 48cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 49cdf0e10cSrcweir cNext != in_c AND cNext != 0; 50cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 51cdf0e10cSrcweir { } 52cdf0e10cSrcweir 53cdf0e10cSrcweir return cNext; 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir inline char 57cdf0e10cSrcweir jumpTo( CharacterSource & io_rText, 58cdf0e10cSrcweir char in_c1, 59cdf0e10cSrcweir char in_c2 ) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir char cNext; 62cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 63cdf0e10cSrcweir cNext != in_c1 AND cNext != in_c2 AND cNext != 0; 64cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 65cdf0e10cSrcweir { } 66cdf0e10cSrcweir 67cdf0e10cSrcweir return cNext; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir inline char 71cdf0e10cSrcweir jumpTo( CharacterSource & io_rText, 72cdf0e10cSrcweir char in_c1, 73cdf0e10cSrcweir char in_c2, 74cdf0e10cSrcweir char in_c3 ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir char cNext; 77cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 78cdf0e10cSrcweir cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 AND cNext != 0; 79cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 80cdf0e10cSrcweir { } 81cdf0e10cSrcweir 82cdf0e10cSrcweir return cNext; 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir inline char 86cdf0e10cSrcweir jumpTo( CharacterSource & io_rText, 87cdf0e10cSrcweir char in_c1, 88cdf0e10cSrcweir char in_c2, 89cdf0e10cSrcweir char in_c3, 90cdf0e10cSrcweir char in_c4 ) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir char cNext; 93cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 94cdf0e10cSrcweir cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 95cdf0e10cSrcweir AND cNext != in_c4 AND cNext != 0; 96cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 97cdf0e10cSrcweir { } 98cdf0e10cSrcweir 99cdf0e10cSrcweir return cNext; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir inline char 103cdf0e10cSrcweir jumpOverWhite(CharacterSource & io_rText) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir char cNext; 106cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 107cdf0e10cSrcweir static_cast<UINT8>(cNext) < 33 108cdf0e10cSrcweir AND cNext != 0 AND cNext != 13 AND cNext != 10; 109cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 110cdf0e10cSrcweir { } 111cdf0e10cSrcweir 112cdf0e10cSrcweir return cNext; 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir inline char 116cdf0e10cSrcweir jumpToWhite(CharacterSource & io_rText) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir char cNext; 119cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 120cdf0e10cSrcweir static_cast<UINT8>(cNext) > 32; 121cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 122cdf0e10cSrcweir { } 123cdf0e10cSrcweir 124cdf0e10cSrcweir return cNext; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir inline char 128cdf0e10cSrcweir jumpToEol(CharacterSource & io_rText, int & o_rCount_BackslashedLineBreaks ) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir o_rCount_BackslashedLineBreaks = 0; 131cdf0e10cSrcweir char cNext; 132cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 133cdf0e10cSrcweir cNext != 13 AND cNext != 10 AND cNext != NULCH; 134cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir if ( cNext == '\\') 137cdf0e10cSrcweir { 138cdf0e10cSrcweir cNext = io_rText.MoveOn(); 139cdf0e10cSrcweir if ( cNext == 13 ) 140cdf0e10cSrcweir io_rText.MoveOn(); 141cdf0e10cSrcweir if ( cNext == 10 ) 142cdf0e10cSrcweir ++o_rCount_BackslashedLineBreaks; 143cdf0e10cSrcweir } 144cdf0e10cSrcweir } 145cdf0e10cSrcweir return cNext; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir inline char 149cdf0e10cSrcweir jumpToEol(CharacterSource & io_rText) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir char cNext; 152cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 153cdf0e10cSrcweir cNext != 13 AND cNext != 10 AND cNext != NULCH; 154cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir if ( cNext == '\\') 157cdf0e10cSrcweir io_rText.MoveOn(); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir return cNext; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir inline char 163cdf0e10cSrcweir jumpOverEol(CharacterSource & io_rText) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir char cNext = io_rText.CurChar(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir if (cNext == 13) 168cdf0e10cSrcweir io_rText.MoveOn(); 169cdf0e10cSrcweir if (cNext == 10) 170cdf0e10cSrcweir io_rText.MoveOn(); 171cdf0e10cSrcweir return cNext; 172cdf0e10cSrcweir } 173cdf0e10cSrcweir 174cdf0e10cSrcweir 175cdf0e10cSrcweir inline char // Finds a matching closing bracket after the opening one is passed 176cdf0e10cSrcweir jumpToMatchingBracket( CharacterSource & io_rText, 177cdf0e10cSrcweir char in_cBegin, 178cdf0e10cSrcweir char in_cEnd ) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir intt nCounter = 1; 181cdf0e10cSrcweir char cNext; 182cdf0e10cSrcweir for ( cNext = io_rText.CurChar(); 183cdf0e10cSrcweir nCounter - (cNext == in_cEnd ? 1 : 0) > 0 AND cNext != NULCH; 184cdf0e10cSrcweir cNext = io_rText.MoveOn() ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir if (cNext == in_cEnd) 187cdf0e10cSrcweir nCounter++; 188cdf0e10cSrcweir else if (cNext == in_cBegin) 189cdf0e10cSrcweir nCounter--; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir return cNext; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196cdf0e10cSrcweir 197cdf0e10cSrcweir 198cdf0e10cSrcweir #endif 199cdf0e10cSrcweir 200