• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision85 (tree)
Time2018-04-12 02:48:02
Authorquiret

Log Message

- fixed up libparse for the latest version of eirrepo/gtaconfig

Change Summary

Incremental Difference

--- parsing/src/sqlparse.cpp (revision 84)
+++ parsing/src/sqlparse.cpp (revision 85)
@@ -7,20 +7,21 @@
77 // Syntax parsers.
88 #include <gtaconfig/include.h>
99
10-inline const char* ParseSQLValueToken( CSyntax& syntax, size_t& lenOut, CSyntax::eTokenType& tokTypeOut )
10+template <typename charType>
11+inline const charType* ParseSQLValueToken( CSyntax <charType>& syntax, size_t& lenOut, SyntaxHelpers::eTokenType& tokTypeOut )
1112 {
12- CSyntax::eTokenType parseTokType;
13+ SyntaxHelpers::eTokenType parseTokType;
1314 size_t tokLen;
14- const char *tok = syntax.ParseTokenEx( &tokLen, parseTokType );
15+ const charType *tok = syntax.ParseTokenEx( &tokLen, parseTokType );
1516
1617 if ( tok && tokLen == 1 )
1718 {
18- char tokChar = *tok;
19+ charType tokChar = *tok;
1920
2021 if ( tokChar == '"' || tokChar == '\'' || tokChar == '`' )
2122 {
2223 size_t strStartPos = syntax.GetOffset();
23- const char *strStart = ( tok + 1 );
24+ const charType *strStart = ( tok + 1 );
2425
2526 bool foundClosing = syntax.ScanCharacterEx( tokChar, true, true, false );
2627
@@ -34,7 +35,7 @@
3435 size_t strCPLen = ( ( strEndPos - strStartPos ) - 1 );
3536
3637 // Fetch the string from the enclosure.
37- tokTypeOut = CSyntax::eTokenType::NAME;
38+ tokTypeOut = SyntaxHelpers::eTokenType::NAME;
3839 lenOut = strCPLen;
3940 return strStart;
4041 }
@@ -69,7 +70,7 @@
6970 return;
7071 }
7172
72- CSyntax dbParser( dbData, dbSize );
73+ CSyntax <char> dbParser( dbData, dbSize );
7374
7475 try
7576 {
@@ -78,7 +79,7 @@
7879 // Skip any comment lines.
7980 if ( dbParser.HasToken( "-" ) )
8081 {
81- if ( dbParser.ReadNext() == '-' )
82+ if ( dbParser.ReadNextSimple() == '-' )
8283 {
8384 dbParser.SkipLine();
8485 }
@@ -109,7 +110,7 @@
109110 // We are looking for insertion statements.
110111 else if ( dbParser.HasTokenSequence( "INSERT INTO" ) )
111112 {
112- CSyntax::eTokenType tableNameTokType;
113+ SyntaxHelpers::eTokenType tableNameTokType;
113114 size_t tableNameLen;
114115 const char *tableName = ParseSQLValueToken( dbParser, tableNameLen, tableNameTokType );
115116
@@ -144,7 +145,7 @@
144145 dbParser.SetOffset( seek );
145146
146147 // Add this token into our list.
147- CSyntax::eTokenType keyNameTokType;
148+ SyntaxHelpers::eTokenType keyNameTokType;
148149 size_t keyNameLen;
149150 const char *keyName = ParseSQLValueToken( dbParser, keyNameLen, keyNameTokType );
150151
@@ -204,7 +205,7 @@
204205
205206 while ( true )
206207 {
207- CSyntax::eTokenType tokenType;
208+ SyntaxHelpers::eTokenType tokenType;
208209 size_t rowTokLen;
209210 const char *rowTok = ParseSQLValueToken( dbParser, rowTokLen, tokenType );
210211
@@ -233,11 +234,11 @@
233234 {
234235 eSQLDBFieldType fieldType = eSQLDBFieldType::STRING;
235236
236- if ( tokenType == CSyntax::eTokenType::NAME )
237+ if ( tokenType == SyntaxHelpers::eTokenType::NAME )
237238 {
238239 fieldType = eSQLDBFieldType::STRING;
239240 }
240- else if ( tokenType == CSyntax::eTokenType::NUMERIC )
241+ else if ( tokenType == SyntaxHelpers::eTokenType::NUMERIC )
241242 {
242243 fieldType = eSQLDBFieldType::NUMERIC;
243244 }
Show on old repository browser