17 #ifndef G3D_TextInput_h
18 #define G3D_TextInput_h
95 : _string(s), _bool(
false), _line(L), _character(c), _bytePosition(byte), _type(t), _extendedType(e) {}
98 : _string(s), _bool(b), _line(L), _character(c), _bytePosition(byte), _type(t), _extendedType(e) {}
226 static double parseNumber(
const std::string& _string);
498 void initFromString(
const char* str,
int len,
const Settings& settings);
514 const std::string& src,
526 const std::string& src,
538 const std::string& src,
551 const std::string& src,
554 const std::string& e,
555 const std::string& a);
566 const std::string& src,
569 const std::string& e,
570 const std::string& a);
579 TextInput(
FS fs,
const std::string& str,
const Settings& settings = Settings());
584 TextInput(
FS fs,
const char* str,
size_t strLen,
const Settings& settings = Settings());
592 settingsStack.
push(options);
597 options = settingsStack.
pop();
811 const std::string& s1,
812 const std::string& s2,
813 const std::string& s3) {
821 const std::string& s1,
822 const std::string& s2,
823 const std::string& s3,
824 const std::string& s4) {
856 const std::string&
filename()
const;
FS
Definition: TextInput.h:575
Definition: TextInput.h:61
Definition: TextInput.h:46
Set< std::string > trueSymbols
Definition: TextInput.h:398
void parseQuotedString(unsigned char delimiter, Token &t)
Definition: TextInput.cpp:882
void push(const T &value)
Definition: Array.h:770
Definition: TextInput.h:62
int peekLineNumber()
Definition: TextInput.cpp:110
Definition: TextInput.h:57
T pop(bool shrinkUnderlyingArrayIfNecessary=true)
Definition: Array.h:837
Definition: TextInput.h:58
bool caseSensitive
Definition: TextInput.h:391
std::string sourceFile
Definition: TextInput.h:507
int eatInputChar()
Definition: TextInput.cpp:217
bool proofSymbols
Definition: TextInput.h:385
char otherCommentCharacter2
Definition: TextInput.h:284
Definition: TextInput.h:45
std::string readNewline()
Definition: TextInput.cpp:1130
std::deque< Token > stack
Definition: TextInput.h:411
const std::string & filename() const
Definition: TextInput.cpp:1238
void readSymbols(const std::string &s1, const std::string &s2)
Definition: TextInput.h:804
char otherCommentCharacter
Definition: TextInput.h:279
int peekCharacterNumber()
Definition: TextInput.cpp:115
Token readSymbolToken()
Definition: TextInput.cpp:1147
Definition: TextInput.h:560
Definition: TextInput.h:50
int _character
Definition: TextInput.h:78
Token(Type t, ExtendedType e, const std::string &s, int L, int c, uint64 byte)
Definition: TextInput.h:94
bool boolean() const
Definition: TextInput.h:117
Definition: TextInput.h:63
Token peek()
Definition: TextInput.cpp:99
WrongTokenType(const std::string &src, int ln, int ch, Token::Type e, Token::Type a)
Definition: TextInput.cpp:1271
Definition: TextInput.h:43
Token readStringToken()
Definition: TextInput.cpp:1054
int line() const
Definition: TextInput.h:125
Dynamic 1D array tuned for performance.
Definition: Array.h:95
bool escapeSequencesInStrings
Definition: TextInput.h:269
ExtendedType extendedType() const
Definition: TextInput.h:104
virtual ~TokenException()
Definition: TextInput.h:509
Set< std::string > falseSymbols
Definition: TextInput.h:401
#define false
Definition: CascPort.h:18
ExtendedType _extendedType
Definition: TextInput.h:81
Definition: TextInput.h:48
void deserialize(std::string &s, BinaryInput &b)
Definition: serialize.h:16
uint64_t uint64
Definition: g3dmath.h:170
ExtendedType
Definition: TextInput.h:40
bool cppBlockComments
Definition: TextInput.h:241
uint64 _bytePosition
Definition: TextInput.h:79
Token()
Definition: TextInput.h:85
int startingLineNumberOffset
Definition: TextInput.h:331
const std::string & string() const
Definition: TextInput.h:113
void init()
Definition: TextInput.cpp:194
#define byte(x, n)
Definition: tomcrypt_macros.h:419
double distance(double x, double y)
Definition: g3dmath.h:731
Definition: TextInput.h:60
void readSymbols(const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4)
Definition: TextInput.h:820
std::string readString()
Definition: TextInput.cpp:1067
int _line
Definition: TextInput.h:77
bool msvcFloatSpecials
Definition: TextInput.h:364
std::string readUntilNewlineAsString()
Definition: TextInput.cpp:180
std::string sourceFileName
Definition: TextInput.h:325
TokenException(const std::string &src, int ln, int ch)
Definition: TextInput.cpp:1244
int character() const
Definition: TextInput.h:133
bool otherLineComments
Definition: TextInput.h:259
Definition: TextInput.h:47
Definition: TextInput.h:34
Definition: TextInput.h:522
void nextToken(Token &t)
Definition: TextInput.cpp:263
int charNumber
Definition: TextInput.h:442
double readNumber()
Definition: TextInput.cpp:1014
Definition: TextInput.h:575
Definition: TextInput.h:59
char singleQuoteCharacter
Definition: TextInput.h:316
bool _bool
Definition: TextInput.h:76
void pushSettings(const Settings &settings)
Definition: TextInput.h:591
std::string readUntilDelimiterAsString(const char delimiter1, const char delimiter2= '\0')
Definition: TextInput.cpp:137
bool readBoolean()
Definition: TextInput.cpp:957
Definition: TextInput.h:545
A simple tokenizer for parsing text files.
Definition: TextInput.h:223
WrongString(const std::string &src, int ln, int ch, const std::string &e, const std::string &a)
Definition: TextInput.cpp:1305
Definition: TextInput.h:233
Array< char > buffer
Definition: TextInput.h:416
BadMSVCSpecial(const std::string &src, int ln, int ch)
Definition: TextInput.cpp:1284
uint64 bytePosition() const
Definition: TextInput.h:139
Array< Settings > settingsStack
Definition: TextInput.h:409
Settings options
Definition: TextInput.h:446
Definition: TextInput.h:502
void initFromString(const char *str, int len, const Settings &settings)
Definition: TextInput.cpp:1211
bool generateCommentTokens
Definition: TextInput.h:293
Token readCommentToken()
Definition: TextInput.cpp:1085
Definition: TextInput.h:41
std::string _string
Definition: TextInput.h:74
Type type() const
Definition: TextInput.h:100
std::string expected
Definition: TextInput.h:562
TextInput(const std::string &filename, const Settings &settings=Settings())
Definition: TextInput.cpp:1186
static double parseNumber(const std::string &_string)
Definition: TextInput.cpp:46
Definition: ParseError.h:22
Definition: TextInput.h:42
Token readNewlineToken()
Definition: TextInput.cpp:1117
Definition: TextInput.h:532
int peekInputChar(int distance=0)
Definition: TextInput.cpp:252
void readSymbols(const std::string &s1, const std::string &s2, const std::string &s3)
Definition: TextInput.h:810
uint8_t uint8
Definition: Define.h:152
Token readSignificant()
Definition: TextInput.cpp:24
Token(Type t, ExtendedType e, const std::string &s, bool b, int L, int c, uint64 byte)
Definition: TextInput.h:97
bool singleQuotedStrings
Definition: TextInput.h:311
void push(const Token &t)
Definition: TextInput.cpp:207
std::string actual
Definition: TextInput.h:548
double number() const
Definition: TextInput.cpp:33
Token::Type expected
Definition: TextInput.h:534
bool generateNewlineTokens
Definition: TextInput.h:301
Token read()
Definition: TextInput.cpp:120
bool cppLineComments
Definition: TextInput.h:249
Type _type
Definition: TextInput.h:80
bool simpleFloatSpecials
Definition: TextInput.h:368
Settings()
Definition: TextInput.cpp:75
int currentCharOffset
Definition: TextInput.h:422
std::string readSymbol()
Definition: TextInput.cpp:1167
std::string expected
Definition: TextInput.h:547
void popSettings()
Definition: TextInput.h:596
std::string actual
Definition: TextInput.h:563
Definition: TextInput.h:49
Type
Definition: TextInput.h:56
int eatAndPeekInputChar()
Definition: TextInput.h:478
static bool parseBoolean(const std::string &_string)
Definition: TextInput.cpp:42
int lineNumber
Definition: TextInput.h:432
std::string readComment()
Definition: TextInput.cpp:1099
Token::Type actual
Definition: TextInput.h:535
int readInteger()
Definition: TextInput.cpp:973
bool hasMore()
Definition: TextInput.cpp:212
Definition: TextInput.h:44
WrongSymbol(const std::string &src, int ln, int ch, const std::string &e, const std::string &a)
Definition: TextInput.cpp:1292
bool signedNumbers
Definition: TextInput.h:305