Changeset 162 for trunk/src


Ignore:
Timestamp:
Jun 22, 2008, 9:02:39 AM (11 years ago)
Author:
cameron
Message:

Fix WhiteSpace? processing for EBCDIC as well as ASCII.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bytelex.h

    r125 r162  
    6060// Whitespace recognition.  This varies between XML 1.0 and
    6161// XML 1.1, but only the XML 1.0 version is needed.
    62 // Specific ASCII/EBCDIC versions are hard-coded here, because
    63 // the Ord metafunction currently only works for printable characters.
    64 // Could be improved. 
    65 template<XML_version, CodeUnit_Base C>
    66 inline bool at_WhiteSpace(unsigned char x8data[]);
    67 
    68 // Workaround because we lack function partial specialization.
     62
    6963template<CodeUnit_Base C>
    7064inline bool at_WhiteSpace_10(unsigned char x8data[]) {
    7165  unsigned char ch = x8data[0];
    7266  return (ch == Ord<C, ' '>::value) ||
    73          (ch == LF<C>::value) || (ch == LF<C>::value) || (ch == HT<C>::value);
    74 }
    75 
    76 template<>
    77 inline bool at_WhiteSpace<XML_1_0, ASCII>(unsigned char x8data[]) {
    78         return at_WhiteSpace_10<ASCII>(x8data);
    79 }
    80 
    81 template<>
    82 inline bool at_WhiteSpace<XML_1_0, EBCDIC>(unsigned char x8data[]) {
    83         return at_WhiteSpace_10<EBCDIC>(x8data);
    84 }
     67         (ch == CR<C>::value) || (ch == LF<C>::value) || (ch == HT<C>::value);
     68}
     69
     70
    8571
    8672template<CodeUnit_Base C>
     
    150136inline bool at_XmlDecl_start(unsigned char x8data[]) {
    151137  return (s5int64(x8data) == c5int64<C, '<', '?', 'x', 'm', 'l'>::value) &&
    152          at_WhiteSpace<XML_1_0, C>(&x8data[5]);
     138         at_WhiteSpace_10<C>(&x8data[5]);
    153139}
    154140
  • trunk/src/xmldecl.c

    r160 r162  
    4949template <CodeUnit_Base C>
    5050inline void XML_Decl_Parser<C>::Scan_WS() {
    51         while (at_WhiteSpace<XML_1_0, C>(cur())) Advance(1);
     51        while (at_WhiteSpace_10<C>(cur())) Advance(1);
    5252}
    5353
     
    103103                return;
    104104        }
    105         if (!at_WhiteSpace<XML_1_0, ASCII>(cur())) DeclarationError(AbsPos());
     105        if (!at_WhiteSpace_10<C>(cur())) DeclarationError(AbsPos());
    106106        Scan_WS();
    107107        if (at_encoding<C>(cur())) {
     
    126126                        return;
    127127                }
    128                 if (!at_WhiteSpace<XML_1_0, ASCII>(cur())) DeclarationError(AbsPos());
     128                if (!at_WhiteSpace_10<C>(cur())) DeclarationError(AbsPos());
    129129                Scan_WS();
    130130        }
     
    174174                Advance(5);
    175175                // Must have whitespace character before declaration.
    176                 if (!at_WhiteSpace<XML_1_0, ASCII>(cur())) DeclarationError(AbsPos());
     176                if (!at_WhiteSpace_10<C>(cur())) DeclarationError(AbsPos());
    177177                Scan_WS();
    178178        }
Note: See TracChangeset for help on using the changeset viewer.