Commit ba78287b authored by dickelbeck's avatar dickelbeck

comments, minor fixes

parent ceb6ad1a
...@@ -107,6 +107,9 @@ const char* DSNLEXER::Syntax( int aTok ) ...@@ -107,6 +107,9 @@ const char* DSNLEXER::Syntax( int aTok )
case DSN_NONE: case DSN_NONE:
ret = "NONE"; ret = "NONE";
break; break;
case DSN_STRING_QUOTE:
ret = "string_quote"; // a special DSN syntax token, see specctra spec.
break;
case DSN_QUOTE_DEF: case DSN_QUOTE_DEF:
ret = "quoted text delimiter"; ret = "quoted text delimiter";
break; break;
...@@ -160,6 +163,7 @@ const char* DSNLEXER::GetTokenText( int aTok ) ...@@ -160,6 +163,7 @@ const char* DSNLEXER::GetTokenText( int aTok )
void DSNLEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError) void DSNLEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError)
{ {
// append to aText, do not overwrite
aText << wxT(" ") << _("in file") << wxT(" \"") << filename aText << wxT(" ") << _("in file") << wxT(" \"") << filename
<< wxT("\" ") << _("on line") << wxT(" ") << reader.LineNumber() << wxT("\" ") << _("on line") << wxT(" ") << reader.LineNumber()
<< wxT(" ") << _("at offset") << wxT(" ") << charOffset; << wxT(" ") << _("at offset") << wxT(" ") << charOffset;
...@@ -192,6 +196,8 @@ int DSNLEXER::NextTok() throw (IOError) ...@@ -192,6 +196,8 @@ int DSNLEXER::NextTok() throw (IOError)
if( cur >= limit ) if( cur >= limit )
{ {
L_read: L_read:
// blank lines are returned as "\n" and will have a len of 1.
// EOF will have a len of 0 and so is detectable.
int len = readLine(); int len = readLine();
if( len == 0 ) if( len == 0 )
{ {
...@@ -235,8 +241,7 @@ L_read: ...@@ -235,8 +241,7 @@ L_read:
ThrowIOError( errtxt, CurOffset() ); ThrowIOError( errtxt, CurOffset() );
} }
curText.clear(); curText = cc;
curText += cc;
head = cur+1; head = cur+1;
...@@ -251,9 +256,7 @@ L_read: ...@@ -251,9 +256,7 @@ L_read:
if( *cur == '(' ) if( *cur == '(' )
{ {
curText.clear(); curText = *cur;
curText += *cur;
curTok = DSN_LEFT; curTok = DSN_LEFT;
head = cur+1; head = cur+1;
goto exit; goto exit;
...@@ -261,9 +264,7 @@ L_read: ...@@ -261,9 +264,7 @@ L_read:
if( *cur == ')' ) if( *cur == ')' )
{ {
curText.clear(); curText = *cur;
curText += *cur;
curTok = DSN_RIGHT; curTok = DSN_RIGHT;
head = cur+1; head = cur+1;
goto exit; goto exit;
...@@ -275,10 +276,9 @@ L_read: ...@@ -275,10 +276,9 @@ L_read:
*/ */
if( *cur == '-' && cur>start && !isSpace( cur[-1] ) ) if( *cur == '-' && cur>start && !isSpace( cur[-1] ) )
{ {
head = cur+1; curText = '-';
curText.clear();
curText += '-';
curTok = DSN_DASH; curTok = DSN_DASH;
head = cur+1;
goto exit; goto exit;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment