/usr/include/OpenSP/Syntax.h is in libosp-dev 1.5.2-10ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Syntax_INCLUDED
#define Syntax_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "Boolean.h"
#include "ISet.h"
#include "StringC.h"
#include "SubstTable.h"
#include "HashTable.h"
#include "Vector.h"
#include "Resource.h"
#include "XcharMap.h"
#include "EntityCatalog.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Sd;
class CharsetInfo;
class SP_API Syntax : public Resource, public EntityCatalog::Syntax {
public:
enum ReservedName {
rALL,
rANY,
rATTLIST,
rCDATA,
rCONREF,
rCURRENT,
rDATA,
rDEFAULT,
rDOCTYPE,
rELEMENT,
rEMPTY,
rENDTAG,
rENTITIES,
rENTITY,
rFIXED,
rID,
rIDLINK,
rIDREF,
rIDREFS,
rIGNORE,
rIMPLICIT,
rIMPLIED,
rINCLUDE,
rINITIAL,
rLINK,
rLINKTYPE,
rMD,
rMS,
rNAME,
rNAMES,
rNDATA,
rNMTOKEN,
rNMTOKENS,
rNOTATION,
rNUMBER,
rNUMBERS,
rNUTOKEN,
rNUTOKENS,
rO,
rPCDATA,
rPI,
rPOSTLINK,
rPUBLIC,
rRCDATA,
rRE,
rREQUIRED,
rRESTORE,
rRS,
rSDATA,
rSHORTREF,
rSIMPLE,
rSPACE,
rSTARTTAG,
rSUBDOC,
rSYSTEM,
rTEMP,
rUSELINK,
rUSEMAP
};
enum { nNames = rUSEMAP + 1 };
enum Quantity {
qATTCNT,
qATTSPLEN,
qBSEQLEN,
qDTAGLEN,
qDTEMPLEN,
qENTLVL,
qGRPCNT,
qGRPGTCNT,
qGRPLVL,
qLITLEN,
qNAMELEN,
qNORMSEP,
qPILEN,
qTAGLEN,
qTAGLVL
};
enum { nQuantity = qTAGLVL + 1 };
enum { unlimited = 100000000 };
enum DelimGeneral {
dAND,
dCOM,
dCRO,
dDSC,
dDSO,
dDTGC,
dDTGO,
dERO,
dETAGO,
dGRPC,
dGRPO,
dHCRO, // WWW TC addition
dLIT,
dLITA,
dMDC,
dMDO,
dMINUS,
dMSC,
dNET,
dNESTC, // WWW TC addition
dOPT,
dOR,
dPERO,
dPIC,
dPIO,
dPLUS,
dREFC,
dREP,
dRNI,
dSEQ,
dSTAGO,
dTAGC,
dVI
};
enum { nDelimGeneral = dVI + 1 };
enum StandardFunction {
fRE,
fRS,
fSPACE
};
enum FunctionClass {
cFUNCHAR,
cSEPCHAR,
cMSOCHAR,
cMSICHAR,
cMSSCHAR
};
enum Set {
nameStart,
digit,
hexDigit,
nmchar, // LCNMCHAR or UCNMCHAR
s,
blank,
sepchar,
minimumData,
significant,
functionChar, // function character
sgmlChar
};
enum { nSet = sgmlChar + 1 };
enum Category {
otherCategory = 0,
sCategory = 01,
nameStartCategory = 02,
digitCategory = 04,
otherNameCategory = 010
};
Syntax(const Sd &);
virtual ~Syntax();
Boolean lookupFunctionChar(const StringC &, Char *) const;
HashTableIter<StringC,Char> functionIter() const;
Boolean charFunctionName(Char c, const StringC *&name) const;
Boolean lookupReservedName(const StringC &, ReservedName *) const;
const StringC &reservedName(ReservedName) const;
StringC rniReservedName(ReservedName) const;
Number quantity(Quantity) const;
Char standardFunction(int) const;
Boolean getStandardFunction(int, Char &) const;
const StringC &delim() const;
const ISet<Char> *charSet(int i) const;
const SubstTable *generalSubstTable() const;
const SubstTable *entitySubstTable() const;
const SubstTable &upperSubstTable() const;
Boolean namecaseGeneral() const;
Boolean namecaseEntity() const;
const StringC &peroDelim() const;
const StringC &delimGeneral(int) const;
const StringC &delimShortrefComplex(size_t) const;
const ISet<Char> &delimShortrefSimple() const;
int nDelimShortrefComplex() const;
Boolean isValidShortref(const StringC &) const;
Boolean hasShortrefs() const;
Boolean isNameCharacter(Xchar) const;
Boolean isNameStartCharacter(Xchar) const;
Boolean isDigit(Xchar) const;
Boolean isHexDigit(Xchar) const;
Boolean isS(Xchar) const;
Boolean isB(Xchar c) const;
Category charCategory(Xchar) const;
Boolean isSgmlChar(Xchar) const;
size_t attcnt() const;
size_t attsplen() const;
size_t namelen() const;
size_t penamelen() const;
size_t litlen() const;
size_t normsep() const;
size_t dtemplen() const;
size_t grpcnt() const;
size_t grpgtcnt() const;
size_t grplvl() const;
size_t taglvl() const;
size_t taglen() const;
size_t entlvl() const;
size_t pilen() const;
Char space() const;
void setStandardFunction(StandardFunction, Char);
void enterStandardFunctionNames();
void addFunctionChar(const StringC &, FunctionClass, Char);
void setNamecaseGeneral(Boolean);
void setNamecaseEntity(Boolean);
void setDelimGeneral(int, const StringC &);
void addDelimShortref(const StringC &, const CharsetInfo &);
void addDelimShortrefs(const ISet<Char> &shortrefChars,
const CharsetInfo &charset);
void addNameCharacters(const ISet<Char> &);
void addNameStartCharacters(const ISet<Char> &);
void addSubst(Char lc, Char uc);
void addShunchar(Char);
void setShuncharControls();
void setQuantity(int, Number);
void setName(int, const StringC &);
void setSgmlChar(const ISet<Char> &);
void implySgmlChar(const Sd &);
// :: is for Watcom 10.0a
void checkSgmlChar(const Sd &,
const ::SP_NAMESPACE_SCOPE Syntax *otherSyntax,
Boolean invalidUseDocumentCharset,
ISet<WideChar> &invalid)
const;
static int referenceQuantity(Quantity);
const XcharMap<unsigned char> &markupScanTable() const;
Boolean multicode() const;
void addEntity(const StringC &, Char);
size_t nEntities() const;
const StringC &entityName(size_t) const;
Char entityChar(size_t) const;
private:
void subst(Char, Char);
void checkUnivControlChar(UnivChar univChar,
const CharsetInfo &docCharset,
const ::SP_NAMESPACE_SCOPE Syntax *otherSyntax,
ISet<WideChar> &invalid) const;
ISet<Char> shunchar_;
PackedBoolean shuncharControls_;
ISet<Char> set_[nSet];
Char standardFunction_[3];
PackedBoolean standardFunctionValid_[3];
Boolean namecaseGeneral_;
Boolean namecaseEntity_;
StringC delimGeneral_[nDelimGeneral];
Vector<StringC> delimShortrefComplex_;
ISet<Char> delimShortrefSimple_;
StringC names_[nNames];
Number quantity_[nQuantity];
HashTable<StringC,int> nameTable_;
HashTable<StringC,Char> functionTable_;
SubstTable upperSubst_;
SubstTable identitySubst_;
const SubstTable *generalSubst_;
const SubstTable *entitySubst_;
XcharMap<unsigned char> categoryTable_;
Boolean multicode_;
XcharMap<unsigned char> markupScanTable_;
Boolean hasMarkupScanTable_;
Vector<StringC> entityNames_;
StringC entityChars_;
static const int referenceQuantity_[];
};
inline Number Syntax::quantity(Quantity q) const
{
return quantity_[q];
}
inline void Syntax::setQuantity(int i, Number n)
{
quantity_[i] = n;
}
inline const SubstTable *Syntax::generalSubstTable() const
{
return generalSubst_;
}
inline const SubstTable *Syntax::entitySubstTable() const
{
return entitySubst_;
}
inline int Syntax::nDelimShortrefComplex() const
{
return int(delimShortrefComplex_.size());
}
inline const StringC &Syntax::delimGeneral(int i) const
{
return delimGeneral_[i];
}
inline const StringC &Syntax::delimShortrefComplex(size_t i) const
{
return delimShortrefComplex_[i];
}
inline const ISet<Char> &Syntax::delimShortrefSimple() const
{
return delimShortrefSimple_;
}
inline Boolean Syntax::hasShortrefs() const
{
return delimShortrefComplex_.size() > 0 || !delimShortrefSimple_.isEmpty();
}
inline Char Syntax::standardFunction(int i) const
{
return standardFunction_[i];
}
inline Boolean Syntax::getStandardFunction(int i, Char &result) const
{
if (standardFunctionValid_[i]) {
result = standardFunction_[i];
return 1;
}
else
return 0;
}
inline const ISet<Char> *Syntax::charSet(int i) const
{
return &set_[i];
}
inline Boolean Syntax::isNameCharacter(Xchar c) const
{
return categoryTable_[c] >= nameStartCategory;
}
inline Boolean Syntax::isNameStartCharacter(Xchar c) const
{
return categoryTable_[c] == nameStartCategory;
}
inline Boolean Syntax::isDigit(Xchar c) const
{
return categoryTable_[c] == digitCategory;
}
inline Boolean Syntax::isS(Xchar c) const
{
return categoryTable_[c] == sCategory;
}
inline Boolean Syntax::isB(Xchar c) const
{
return (categoryTable_[c] == sCategory
&& !(standardFunctionValid_[fRE] && c == standardFunction_[fRE])
&& !(standardFunctionValid_[fRS] && c == standardFunction_[fRS]));
}
inline Syntax::Category Syntax::charCategory(Xchar c) const
{
return Category(categoryTable_[c]);
}
inline Boolean Syntax::isSgmlChar(Xchar c) const
{
return c >= 0 && set_[sgmlChar].contains(Char(c));
}
inline const StringC &Syntax::reservedName(ReservedName i) const
{
return names_[i];
}
inline size_t Syntax::attcnt() const
{
return quantity(Syntax::qATTCNT);
}
inline size_t Syntax::attsplen() const
{
return quantity(Syntax::qATTSPLEN);
}
inline size_t Syntax::namelen() const
{
return quantity(Syntax::qNAMELEN);
}
inline size_t Syntax::penamelen() const
{
return quantity(Syntax::qNAMELEN) - delimGeneral(Syntax::dPERO).size();
}
inline size_t Syntax::litlen() const
{
return quantity(Syntax::qLITLEN);
}
inline size_t Syntax::normsep() const
{
return quantity(Syntax::qNORMSEP);
}
inline size_t Syntax::dtemplen() const
{
return quantity(Syntax::qDTEMPLEN);
}
inline size_t Syntax::grpcnt() const
{
return quantity(Syntax::qGRPCNT);
}
inline size_t Syntax::grpgtcnt() const
{
return quantity(Syntax::qGRPGTCNT);
}
inline size_t Syntax::grplvl() const
{
return quantity(Syntax::qGRPLVL);
}
inline size_t Syntax::taglvl() const
{
return quantity(Syntax::qTAGLVL);
}
inline size_t Syntax::taglen() const
{
return quantity(Syntax::qTAGLEN);
}
inline size_t Syntax::entlvl() const
{
return quantity(Syntax::qENTLVL);
}
inline size_t Syntax::pilen() const
{
return quantity(Syntax::qPILEN);
}
inline Char Syntax::space() const
{
return standardFunction(Syntax::fSPACE);
}
inline void Syntax::setSgmlChar(const ISet<Char> &set)
{
set_[sgmlChar] = set;
}
inline int Syntax::referenceQuantity(Quantity i)
{
return referenceQuantity_[i];
}
inline void Syntax::setShuncharControls()
{
shuncharControls_ = 1;
}
inline const XcharMap<unsigned char> &Syntax::markupScanTable() const
{
return markupScanTable_;
}
inline Boolean Syntax::multicode() const
{
return multicode_;
}
inline Boolean Syntax::namecaseGeneral() const
{
return namecaseGeneral_;
}
inline Boolean Syntax::namecaseEntity() const
{
return namecaseEntity_;
}
inline size_t Syntax::nEntities() const
{
return entityNames_.size();
}
inline const StringC &Syntax::entityName(size_t i) const
{
return entityNames_[i];
}
inline Char Syntax::entityChar(size_t i) const
{
return entityChars_[i];
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* Syntax_INCLUDED */
|