125 if ( punctuations == default_punctuations ) {
141 for (i = 0; punctuations[
i].
p; i++) {
148 for (i = 0; punctuations[
i].
p; i++) {
149 newp = &punctuations[
i];
153 p = &punctuations[
n];
154 if (strlen(p->
p) < strlen(newp->
p)) {
191 return "unkown punctuation";
364 case '\\': c =
'\\';
break;
365 case 'n': c =
'\n';
break;
366 case 'r': c =
'\r';
break;
367 case 't': c =
'\t';
break;
368 case 'v': c =
'\v';
break;
369 case 'b': c =
'\b';
break;
370 case 'f': c =
'\f';
break;
371 case 'a': c =
'\a';
break;
372 case '\'': c =
'\'';
break;
373 case '\"': c =
'\"';
break;
374 case '\?': c =
'\?';
break;
380 if (c >=
'0' && c <=
'9')
382 else if (c >=
'A' && c <=
'Z')
384 else if (c >=
'a' && c <=
'z')
388 val = (val << 4) + c;
400 if (*idLexer::script_p < '0' || *idLexer::script_p >
'9') {
405 if (c >=
'0' && c <=
'9')
438 const char *tmpscript_p;
441 if ( quote ==
'\"' ) {
512 token->
data[token->
len] =
'\0';
516 if ( token->
Length() != 1 ) {
541 }
while ((c >=
'a' && c <=
'z') ||
542 (c >=
'A' && c <=
'Z') ||
543 (c >=
'0' && c <=
'9') ||
549 token->
data[token->
len] =
'\0';
563 for ( i = 0; str[
i]; i++ ) {
589 if ( c ==
'0' && c2 !=
'.' ) {
591 if ( c2 ==
'x' || c2 ==
'X' ) {
595 while((c >=
'0' && c <=
'9') ||
596 (c >=
'a' && c <=
'f') ||
597 (c >=
'A' && c <=
'F')) {
604 else if ( c2 ==
'b' || c2 ==
'B' ) {
608 while( c ==
'0' || c ==
'1' ) {
618 while( c >=
'0' && c <=
'7' ) {
629 if ( c >=
'0' && c <=
'9' ) {
631 else if ( c ==
'.' ) {
640 if( c ==
'e' && dot == 0) {
656 else if ( c ==
'+' ) {
660 while( c >=
'0' && c <=
'9' ) {
666 else if ( c ==
'#' ) {
685 for ( i = 0; i < c2; i++ ) {
689 while( c >=
'0' && c <=
'9' ) {
699 else if ( dot > 1 ) {
718 if ( c ==
'f' || c ==
'F' ) {
723 else if ( c ==
'l' || c ==
'L' ) {
739 for ( i = 0; i < 2; i++ ) {
741 if ( c ==
'l' || c ==
'L' ) {
745 else if ( c ==
'u' || c ==
'U' ) {
759 while( c >=
'0' && c <=
'9' ) {
766 token->
data[token->
len] =
'\0';
793 if ( idLexer::script_p[l] != p[l] ) {
800 for ( i = 0; i <=
l; i++ ) {
805 idLexer::script_p +=
l;
839 token->
data[0] =
'\0';
863 if ( c ==
'\"' || c ==
'\'' ) {
872 else if ( (c >=
'0' && c <=
'9') ||
880 if ( (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z') || c ==
'_' ) {
888 else if ( c ==
'\"' || c ==
'\'' ) {
894 else if ( (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z') || c ==
'_' ) {
926 if ( token !=
string ) {
946 if ( token->
type != type ) {
951 case TT_NAME: str =
"name";
break;
953 default: str =
"unknown type";
break;
959 if ( (token->
subtype & subtype) != subtype ) {
962 if ( subtype &
TT_HEX ) str =
"hex ";
963 if ( subtype &
TT_OCTAL ) str =
"octal ";
964 if ( subtype &
TT_BINARY ) str =
"binary ";
966 if ( subtype &
TT_LONG ) str +=
"long ";
967 if ( subtype &
TT_FLOAT ) str +=
"float ";
968 if ( subtype &
TT_INTEGER ) str +=
"integer ";
979 if ( token->
subtype != subtype ) {
1014 if ( tok ==
string ) {
1035 if (tok.
type == type && (tok.
subtype & subtype) == subtype) {
1062 if ( tok ==
string ) {
1085 if ( tok.
type == type && ( tok.
subtype & subtype ) == subtype ) {
1101 if ( token ==
string ) {
1138 depth = parseFirstBrace ? 0 : 1;
1144 if ( token ==
"{" ) {
1146 }
else if ( token ==
"}" ) {
1276 idLexer::Error(
"couldn't read expected floating point number" );
1307 for ( i = 0; i <
x; i++ ) {
1329 for ( i = 0; i <
y; i++ ) {
1353 for ( i = 0 ; i <
z; i++ ) {
1384 return out.
c_str( );
1429 for ( ; i > 0; i-- ) {
1459 Error(
"missing closing brace" );
1469 if ( token[0] ==
'{' ) {
1472 else if ( token[0] ==
'}' ) {
1478 out +=
"\"" + token +
"\"";
1524 return whiteSpace.
Length();
1602 if ( !OSPath && (
baseFolder[0] !=
'\0' ) ) {
1618 fp->
Read( buf, length );
int CheckTokenString(const char *string)
const char * whiteSpaceStart_p
const char * ReadRestOfLine(idStr &out)
virtual idFile * OpenFileRead(const char *relativePath, bool allowCopyFiles=true, const char *gamedir=NULL)=0
const char * whiteSpaceStart_p
int GetPunctuationId(const char *p)
void void bool HadError(void) const
int ReadEscapeCharacter(char *ch)
int ReadName(idToken *token)
int CheckString(const char *str) const
const char * lastScript_p
int Parse1DMatrix(int x, float *m)
void StripTrailing(const char c)
virtual idFile * OpenExplicitFileRead(const char *OSPath)=0
int GetLastWhiteSpaceStart(void) const
int SkipBracedSection(bool parseFirstBrace=true)
float GetFloatValue(void)
GLint GLint GLsizei GLsizei GLsizei depth
int CheckTokenType(int type, int subtype, idToken *token)
GLuint GLuint GLsizei GLenum type
int default_nextpunctuation[sizeof(default_punctuations)/sizeof(punctuation_t)]
int PeekTokenString(const char *string)
float ParseFloat(bool *errorFlag=NULL)
static char baseFolder[256]
int ReadTokenOnLine(idToken *token)
int default_punctuationtable[256]
#define TT_EXTENDED_PRECISION
#define P_PARENTHESESCLOSE
int ReadPunctuation(idToken *token)
int ExpectAnyToken(idToken *token)
void Error(const char *str,...) id_attribute((format(printf
int ExpectTokenType(int type, int subtype, idToken *token)
static class idFileSystem * fileSystem
const char * whiteSpaceEnd_p
punctuation_t default_punctuations[]
void SetPunctuations(const punctuation_t *p)
void EnsureAlloced(int amount, bool keepold=true)
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
virtual int Read(void *buffer, int len)
static void Copynz(char *dest, const char *src, int destsize)
int PeekTokenType(int type, int subtype, idToken *token)
const char * whiteSpaceEnd_p
void UnreadToken(const idToken *token)
int LoadMemory(const char *ptr, int length, const char *name, int startLine=1)
const char * GetPunctuationFromId(int id)
virtual ID_TIME_T Timestamp(void)
int Parse3DMatrix(int z, int y, int x, float *m)
void CreatePunctuationTable(const punctuation_t *punctuations)
int ExpectTokenString(const char *string)
void void Warning(const char *str,...) id_attribute((format(printf
static void SetBaseFolder(const char *path)
#define TT_SINGLE_PRECISION
int NumLinesCrossed(void)
void Append(const char a)
int GetLastWhiteSpace(idStr &whiteSpace) const
GLsizei const GLcharARB const GLint * length
int GetLastWhiteSpaceEnd(void) const
int vsprintf(idStr &string, const char *fmt, va_list argptr)
const char * c_str(void) const
int SkipUntilString(const char *string)
int Parse2DMatrix(int y, int x, float *m)
void AppendDirty(const char a)
void * Mem_Alloc(const int size)
const char * ParseBracedSection(idStr &out)
float dot(float a[], float b[])
const punctuation_t * punctuations
char * va(const char *fmt,...)
int ReadString(idToken *token, int quote)
virtual void CloseFile(idFile *f)=0
int ReadNumber(idToken *token)
virtual void Error(const char *fmt,...) id_attribute((format(printf
const char * ParseRestOfLine(idStr &out)
#define P_PARENTHESESOPEN
const char * ParseBracedSectionExact(idStr &out, int tabs=-1)
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
int ReadToken(idToken *token)
virtual const char * GetFullPath(void)
#define TT_DOUBLE_PRECISION
int LoadFile(const char *filename, bool OSPath=false)
static class idCommon * common