本文整理汇总了C++中BFFIterator类的典型用法代码示例。如果您正苦于以下问题:C++ BFFIterator类的具体用法?C++ BFFIterator怎么用?C++ BFFIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BFFIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tokenStart
// ParseDefineDirective
//------------------------------------------------------------------------------
bool BFFParser::ParseDefineDirective( BFFIterator & iter )
{
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
// parse out token
const BFFIterator tokenStart( iter );
iter.SkipVariableName();
if ( tokenStart.GetCurrent() == iter.GetCurrent() )
{
Error::Error_1007_ExpectedVariable( iter, nullptr );
return false;
}
const BFFIterator tokenEnd( iter );
AStackString<> token( tokenStart.GetCurrent(), tokenEnd.GetCurrent() );
if ( BFFMacros::Get().Define( token ) == false )
{
Error::Error_1038_OverwritingTokenInDefine( tokenStart );
return false;
}
FLOG_INFO( "Define macro <%s>", token.Get() );
return true;
}
示例2: scopeStart
// ParseUnnamedScope
//------------------------------------------------------------------------------
bool BFFParser::ParseUnnamedScope( BFFIterator & iter )
{
// find the matching bracket
BFFIterator scopeStart( iter );
if ( iter.ParseToMatchingBrace( BFF_SCOPE_OPEN, BFF_SCOPE_CLOSE ) == false )
{
Error::Error_1025_MissingScopeCloseToken( scopeStart, nullptr );
return false;
}
// create stack for scope
BFFStackFrame stackFrame;
// parse the scoped part
BFFParser subParser;
BFFIterator subIter( scopeStart );
subIter++; // skip opening token
subIter.SetMax( iter.GetCurrent() ); // limit to closing token
if ( subParser.Parse( subIter ) == false )
{
return false;
}
iter++; // skip closing }
return true;
}
示例3: directiveStart
// ParsePreprocessorDirective
//------------------------------------------------------------------------------
bool BFFParser::ParsePreprocessorDirective( BFFIterator & iter )
{
const BFFIterator directiveStart( iter );
// skip directive start token
ASSERT( *iter == BFF_PREPROCESSOR_START );
iter++;
// allow whitepace before directive name
iter.SkipWhiteSpace();
// start of directive name
BFFIterator directiveStartIter( iter );
// find end of directive
while ( iter.IsAtValidDirectiveNameCharacter() )
{
iter++;
}
BFFIterator directiveEndIter( iter );
iter.SkipWhiteSpace();
// determine directive
AStackString< MAX_DIRECTIVE_NAME_LENGTH > directive( directiveStartIter.GetCurrent(), directiveEndIter.GetCurrent() );
if ( directive == "include" )
{
return ParseIncludeDirective( iter );
}
else if ( directive == "once" )
{
FBuild::Get().GetDependencyGraph().SetCurrentFileAsOneUse();
return true;
}
else if ( directive == "define" )
{
return ParseDefineDirective( iter );
}
else if ( directive == "undef" )
{
return ParseUndefDirective( iter );
}
else if ( directive == "if" )
{
return ParseIfDirective( directiveStart, iter );
}
else if ( directive == "endif" )
{
return ParseEndIfDirective( directiveStartIter );
}
else if ( directive == "import" )
{
return ParseImportDirective( directiveStart, iter );
}
// unknown
Error::Error_1030_UnknownDirective( directiveStartIter, directive );
return false;
}
示例4: CheckIfCondition
// CheckIfCondition
//------------------------------------------------------------------------------
bool BFFParser::CheckIfCondition( const BFFIterator & conditionStart, const BFFIterator & conditionEnd, bool & result )
{
// trim condition
AStackString<> condition( conditionStart.GetCurrent(), conditionEnd.GetCurrent() );
result = BFFMacros::Get().IsDefined( condition );
return true;
}
示例5: varNameStart
// ParseImportDirective
//------------------------------------------------------------------------------
bool BFFParser::ParseImportDirective( const BFFIterator & directiveStart, BFFIterator & iter )
{
iter.SkipWhiteSpace();
// make sure we haven't hit the end of the file
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( directiveStart );
return false;
}
// make sure this is a variable name
if ( iter.IsAtValidVariableNameCharacter() == false )
{
Error::Error_1013_UnexpectedCharInVariableName( iter, nullptr );
return false;
}
// find the end of the variable name
const BFFIterator varNameStart( iter );
iter.SkipVariableName();
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
const BFFIterator varNameEnd( iter );
// sanity check it is a sensible length
size_t varNameLen = varNameStart.GetDistTo( varNameEnd );
if ( varNameLen > MAX_VARIABLE_NAME_LENGTH )
{
Error::Error_1014_VariableNameIsTooLong( iter, (uint32_t)varNameLen, (uint32_t)MAX_VARIABLE_NAME_LENGTH );
return false;
}
AStackString<> varName( varNameStart.GetCurrent(), varNameEnd.GetCurrent() );
// look for varName in system environment
AStackString<> varValue;
uint32_t varHash = 0;
if ( FBuild::Get().ImportEnvironmentVar( varName.Get(), varValue, varHash ) == false )
{
Error::Error_1009_UnknownVariable( varNameStart, nullptr );
return false;
}
// add the dot to variable name
varName = ".";
varName.Append( varNameStart.GetCurrent(), varNameLen );
// import variable in current scope
BFFStackFrame::SetVarString( varName, varValue, nullptr );
FLOG_INFO( "Imported <string> variable '%s' with value '%s' from system environment", varName.Get(), varValue.Get() );
return true;
}
示例6: subIter
// StoreVariableStruct
//------------------------------------------------------------------------------
bool BFFParser::StoreVariableStruct( const AString & name,
const BFFIterator & valueStart, const BFFIterator & valueEnd,
const BFFIterator & operatorIter,
BFFStackFrame * frame )
{
// are we concatenating?
if ( *operatorIter == BFF_VARIABLE_CONCATENATION )
{
// concatenation of structs not supported
Error::Error_1027_CannotModify( operatorIter, name, BFFVariable::VAR_STRUCT, BFFVariable::VAR_ANY );
return false;
}
// create stack frame to capture variables
BFFStackFrame stackFrame;
// parse all the variables in the scope
BFFParser subParser;
BFFIterator subIter( valueStart );
subIter.SetMax( valueEnd.GetCurrent() ); // limit to closing token
if ( subParser.Parse( subIter ) == false )
{
return false; // error will be emitted by Parse
}
// get variables defined in the scope
const Array< const BFFVariable * > & structMembers = stackFrame.GetLocalVariables();
// Register this variable
BFFStackFrame::SetVarStruct( name, structMembers, frame ? frame : stackFrame.GetParent() );
FLOG_INFO( "Registered <struct> variable '%s' with %u members", name.Get(), structMembers.GetSize() );
return true;
}
示例7: ASSERT
// ParseNamedVariableName
//------------------------------------------------------------------------------
/*static*/ bool BFFParser::ParseVariableName( BFFIterator & iter, AString & name, bool & parentScope )
{
// skip over the declaration symbol
ASSERT( *iter == BFF_DECLARE_VAR_INTERNAL ||
*iter == BFF_DECLARE_VAR_PARENT );
parentScope = ( *iter == BFF_DECLARE_VAR_PARENT );
const BFFIterator varNameStart = iter; // include type token in var name
iter++;
// make sure we haven't hit the end of the file
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
// make sure immediately after the symbol starts a variable name
if ( iter.IsAtValidVariableNameCharacter() == false )
{
Error::Error_1013_UnexpectedCharInVariableName( iter, nullptr );
return false;
}
// find the end of the variable name
iter.SkipVariableName();
const BFFIterator varNameEnd = iter;
// sanity check it is a sensible length
size_t varNameLen = varNameStart.GetDistTo( varNameEnd );
if ( varNameLen > MAX_VARIABLE_NAME_LENGTH )
{
Error::Error_1014_VariableNameIsTooLong( iter, (uint32_t)varNameLen, (uint32_t)MAX_VARIABLE_NAME_LENGTH );
return false;
}
// store variable name
name.Assign( varNameStart.GetCurrent(), varNameEnd.GetCurrent() );
if ( parentScope )
{
// exchange '^' with '.'
ASSERT( BFF_DECLARE_VAR_PARENT == name[0] );
name[0] = BFF_DECLARE_VAR_INTERNAL;
}
return true;
}
示例8: CheckIfCondition
// CheckIfCondition
//------------------------------------------------------------------------------
bool BFFParser::CheckIfCondition( const BFFIterator & conditionStart, const BFFIterator & conditionEnd, bool & result )
{
// trim condition
AStackString<> condition( conditionStart.GetCurrent(), conditionEnd.GetCurrent() );
condition.Replace( '\t', ' ' );
condition.Replace( " ", "" );
result = false;
// For now we only support trivial pre-defined expressions - TODO:B Support more complex expressions
if ( condition == "__WINDOWS__" )
{
#if defined( __WINDOWS__ )
result = true;
#endif
return true;
}
if ( condition == "__LINUX__" )
{
#if defined( __LINUX__ )
result = true;
#endif
return true;
}
if ( condition == "__OSX__" )
{
#if defined( __OSX__ )
result = true;
#endif
return true;
}
// We found an expression we don't understand
Error::Error_1036_UnknownTokenInIfDirective( conditionStart );
return false;
}
示例9: ParseNamedVariableDeclaration
// ParseNamedVariableDeclaration
//------------------------------------------------------------------------------
bool BFFParser::ParseNamedVariableDeclaration( BFFIterator & iter )
{
// skip over the declaration symbol
ASSERT( *iter == BFF_DECLARE_VAR_INTERNAL );
m_LastVarNameStart = iter; // include type token in var name
iter++;
// make sure we haven't hit the end of the file
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
// make sure immediately after the symbol starts a variable name
if ( iter.IsAtValidVariableNameCharacter() == false )
{
Error::Error_1013_UnexpectedCharInVariableName( iter, nullptr );
return false;
}
// find the end of the variable name
iter.SkipVariableName();
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
m_LastVarNameEnd = iter;
// sanity check it is a sensible length
size_t varNameLen = m_LastVarNameStart.GetDistTo( m_LastVarNameEnd );
if ( varNameLen > MAX_VARIABLE_NAME_LENGTH )
{
Error::Error_1014_VariableNameIsTooLong( iter, (uint32_t)varNameLen, (uint32_t)MAX_VARIABLE_NAME_LENGTH );
return false;
}
// find the start of the assignment
iter.SkipWhiteSpaceAndComments();
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
return ParseVariableDeclaration( iter, m_LastVarNameStart, m_LastVarNameEnd );
}
示例10: ASSERT
// FormatError
//------------------------------------------------------------------------------
void Error::FormatError( const BFFIterator & iter,
uint32_t errNum,
const Function * function,
const char * message, ... )
{
ASSERT( message );
AStackString< 4096 > buffer;
va_list args;
va_start(args, message);
buffer.VFormat( message, args );
va_end( args );
// get human readable info about the position of the error
uint32_t line = 0;
uint32_t column = 0;
const char * lineStart = nullptr;
iter.GetPosInfo( line, column, lineStart );
// convert to full path and '/'->'\' cleanup
const AStackString<> fileName( iter.GetFileName() );
AStackString<> fullPath;
NodeGraph::CleanPath( fileName, fullPath );
// deliberately using OUTPUT here to avoid "Error:" in front
OUTPUT( "%s(%u,%u): FASTBuild Error #%04u - %s%s%s\n",
fullPath.Get(),
line,
column,
errNum,
function ? function->GetName().Get() : "",
function ? "() - " : "",
buffer.Get() );
// find the line end
BFFIterator lineEnd( iter );
while ( !lineEnd.IsAtEnd() )
{
if (( *lineEnd != '\r' ) && ( *lineEnd != '\n' ))
{
lineEnd++;
continue;
}
break;
}
// if line is too crazy to be useful, don't print anything more
size_t lineLength = lineEnd.GetCurrent() - lineStart;
if ( lineLength >= 256 )
{
return;
}
// print the problematic line
AString::Copy( lineStart, buffer.Get(), lineLength );
FLOG_ERROR( "%s", buffer.Get() );
// point to the specific pos where parsing broke
// (taking into account tabs)
char * c = buffer.Get();
const char * end = c + column - 1;
for ( ; c < end; ++c )
{
if ( *c != '\t' )
{
*c = ' ';
}
}
AString::Copy( "^", c, 1 );
FLOG_ERROR( buffer.Get() );
AString::Copy( "\\--here", c, 8 );
FLOG_ERROR( buffer.Get() );
}
示例11: conditionStart
// ParseIfDirective
//------------------------------------------------------------------------------
bool BFFParser::ParseIfDirective( const BFFIterator & directiveStart, BFFIterator & iter )
{
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
bool negate = false;
if ( *iter == '!' )
{
negate = true; // the condition will be inverted
iter++; // skip '!'
iter.SkipWhiteSpace(); // allow whitepace after '!'
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
}
// parse out condition
const BFFIterator conditionStart( iter );
iter.SkipVariableName();
if ( conditionStart.GetCurrent() == iter.GetCurrent() )
{
Error::Error_1007_ExpectedVariable( directiveStart, nullptr );
return false;
}
const BFFIterator conditionEnd( iter );
// Evaluate the condition
bool result;
if ( CheckIfCondition( conditionStart, conditionEnd, result ) == false )
{
return false; // CheckIfCondition will have emitted an error
}
// #ifndef ?
if ( negate )
{
result = !( result );
}
if ( result )
{
++s_IfDepth; // Track that we're inside an if block
return true; // continue parsing like normal
}
// Advance iterator past entire #if block
size_t depth = 1; // handle nested ifs
while ( depth > 0 )
{
// did we hit the end of the file?
if ( iter.IsAtEnd() )
{
(void)directiveStart; // TODO: Show we're looking for matching endif to this
Error::Error_1012_UnexpectedEndOfFile( iter ); // TODO:B better error for this?
return false;
}
// find the next preprocessor directive
iter.SkipWhiteSpace();
if ( *iter == BFF_PREPROCESSOR_START )
{
iter++; // skip #
iter.SkipWhiteSpace(); // allow whitespace between # and directive
const BFFIterator directiveNameStart( iter );
while ( iter.IsAtValidDirectiveNameCharacter() )
{
iter++;
}
const BFFIterator directiveNameEnd( iter );
AStackString<> directiveName( directiveNameStart.GetCurrent(), directiveNameEnd.GetCurrent() );
if ( directiveName == "endif" )
{
--depth;
}
else if ( directiveName == "if" )
{
++depth;
}
// continue to skip rest of line....
}
// skip rest of line
while ( ( iter.IsAtEnd() == false ) &&
( *iter != '\r' ) &&
( *iter != '\n' ) )
{
iter++;
}
}
return true;
}
示例12: Parse
// Parse
//------------------------------------------------------------------------------
bool BFFParser::Parse( BFFIterator & iter )
{
for (;;)
{
iter.SkipWhiteSpace();
// is this a comment?
if ( iter.IsAtComment() )
{
iter.SkipComment();
continue;
}
const char c = *iter;
switch ( c )
{
case BFF_DECLARE_VAR_INTERNAL:
case BFF_DECLARE_VAR_PARENT:
{
if ( ParseNamedVariableDeclaration( iter ) == false )
{
return false;
}
continue;
}
case BFF_VARIABLE_CONCATENATION:
case BFF_VARIABLE_SUBTRACTION:
{
// concatenation to last used variable
if ( ParseUnnamedVariableModification( iter ) == false )
{
return false;
}
continue;
}
case BFF_SCOPE_OPEN:
{
// start an unnamed scope
if ( ParseUnnamedScope( iter ) == false )
{
return false;
}
continue;
}
case BFF_PREPROCESSOR_START:
{
if ( ParsePreprocessorDirective( iter ) == false )
{
return false;
}
continue;
}
default:
{
if ( iter.IsAtValidFunctionNameCharacter() )
{
if ( ParseFunction( iter ) == false )
{
return false;
}
continue;
}
}
}
iter.SkipWhiteSpace();
if ( iter.IsAtEnd() == false )
{
Error::Error_1010_UnknownConstruct( iter );
return false;
}
break; // cleanly hit end of file
}
return true;
}
示例13: values
// StoreVariableArray
//------------------------------------------------------------------------------
bool BFFParser::StoreVariableArray( const AString & name,
const BFFIterator & valueStart, const BFFIterator & valueEnd,
const BFFIterator & operatorIter,
BFFStackFrame * frame )
{
Array< AString > values( 32, true );
Array< const BFFVariable * > structValues( 32, true );
// are we concatenating?
if ( ( *operatorIter == BFF_VARIABLE_CONCATENATION ) ||
( *operatorIter == BFF_VARIABLE_SUBTRACTION ) )
{
// find existing
const BFFVariable * var = BFFStackFrame::GetVar( name, frame );
if ( var == nullptr )
{
Error::Error_1026_VariableNotFoundForModification( operatorIter, name );
return false;
}
// make sure existing is an array
if ( var->IsArrayOfStrings() )
{
// get values to start with
values = var->GetArrayOfStrings();
}
else if ( var->IsArrayOfStructs() )
{
// get values to start with
structValues = var->GetArrayOfStructs();
}
else
{
// TODO:B Improve this error to handle ArrayOfStructs case
Error::Error_1027_CannotModify( operatorIter, name, var->GetType(), BFFVariable::VAR_ARRAY_OF_STRINGS );
return false;
}
}
// Parse array of variables
BFFIterator iter( valueStart );
for (;;)
{
iter.SkipWhiteSpaceAndComments();
// end?
if ( iter.GetCurrent() == valueEnd.GetCurrent() )
{
break;
}
const char c = *iter;
if ( ( c == '"' ) || ( c == '\'' ) )
{
// a quoted string
// detect mistmatches
if ( structValues.IsEmpty() == false )
{
// Mixed types in vector
Error::Error_1034_OperationNotSupported( iter,
BFFVariable::VAR_ARRAY_OF_STRUCTS,
BFFVariable::VAR_STRING,
operatorIter );
return false;
}
// subtraction not supported on arrays
if ( *operatorIter == BFF_VARIABLE_SUBTRACTION )
{
Error::Error_1034_OperationNotSupported( iter, BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING, operatorIter );
return false;
}
// a string
BFFIterator elementValueStart( iter );
iter.SkipString( c );
ASSERT( iter.GetCurrent() <= valueEnd.GetCurrent() ); // should not be in this function if string is not terminated
elementValueStart++; // move to start of actual content
AStackString< 2048 > elementValue;
// unescape and subsitute embedded variables
if ( PerformVariableSubstitutions( elementValueStart, iter, elementValue ) == false )
{
return false;
}
values.Append( elementValue );
iter++; // pass closing quote
}
else if ( c == BFF_DECLARE_VAR_INTERNAL ||
c == BFF_DECLARE_VAR_PARENT )
{
const BFFIterator elementStartValue = iter;
// a variable
AStackString< MAX_VARIABLE_NAME_LENGTH > varName;
//.........这里部分代码省略.........
示例14: stringStart
// ParseIncludeDirective
//------------------------------------------------------------------------------
bool BFFParser::ParseIncludeDirective( BFFIterator & iter )
{
// Sanity check include depth to detect cyclic includes
if ( s_Depth >= 128 )
{
Error::Error_1035_ExcessiveDepthComplexity( iter );
return false;
}
// we expect a " quoted string
if ( *iter != '"' )
{
Error::Error_1031_UnexpectedCharFollowingDirectiveName( iter, AStackString<>( "include" ), '"' );
return false;
}
BFFIterator stringStart( iter );
stringStart++; // first actual character
// find end of string
if ( iter.ParseToNext( '"' ) == false )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
// unescape and substitute variables
AStackString<> include;
if ( PerformVariableSubstitutions( stringStart, iter, include ) == false )
{
return false;
}
iter++; // skip closing quote before returning
FLOG_INFO( "Including: %s\n", include.Get() );
// open include
// 1) Try current directory
AStackString<> includeToUse;
if (PathUtils::IsFullPath(include) == false)
{
const char * lastSlash = iter.GetFileName().FindLast( NATIVE_SLASH );
lastSlash = lastSlash ? lastSlash : iter.GetFileName().FindLast( OTHER_SLASH );
lastSlash = lastSlash ? ( lastSlash + 1 ): iter.GetFileName().Get(); // file only, truncate to empty
includeToUse.Assign( iter.GetFileName().Get(), lastSlash );
}
includeToUse += include;
AStackString<> includeToUseClean;
NodeGraph::CleanPath( includeToUse, includeToUseClean );
FileStream f;
if ( f.Open( includeToUseClean.Get(), FileStream::READ_ONLY ) == false )
{
Error::Error_1032_UnableToOpenInclude( stringStart, includeToUseClean );
return false;
}
// check if include uses "once" pragma
if ( FBuild::Get().GetDependencyGraph().IsOneUseFile( includeToUseClean ) )
{
// already seen, and uses #once : don't include again
return true;
}
uint64_t includeTimeStamp = FileIO::GetFileLastWriteTime( includeToUseClean );
// read content of include
const uint32_t fileSize = (uint32_t)f.GetFileSize();
AutoPtr< char > mem( (char *)ALLOC( fileSize + 1 ) );
if ( f.Read( mem.Get(), fileSize ) != fileSize )
{
Error::Error_1033_ErrorReadingInclude( stringStart, include, Env::GetLastErr() );
return false;
}
mem.Get()[ fileSize ] = '\000'; // sentinel
BFFParser parser;
const bool pushStackFrame = false; // include is treated as if injected at this point
return parser.Parse( mem.Get(), fileSize, includeToUseClean.Get(), includeTimeStamp, pushStackFrame );
}
示例15: ASSERT
// ParseNamedVariableName
//------------------------------------------------------------------------------
/*static*/ bool BFFParser::ParseVariableName( BFFIterator & iter, AString & name, bool & parentScope )
{
// skip over the declaration symbol
ASSERT( *iter == BFF_DECLARE_VAR_INTERNAL ||
*iter == BFF_DECLARE_VAR_PARENT );
parentScope = ( *iter == BFF_DECLARE_VAR_PARENT );
const BFFIterator varNameStart = iter; // include type token in var name
iter++;
// make sure we haven't hit the end of the file
if ( iter.IsAtEnd() )
{
Error::Error_1012_UnexpectedEndOfFile( iter );
return false;
}
if ( *iter == '\'' || *iter == '"' )
{
// parse the string
const BFFIterator openToken = iter;
iter.SkipString( *openToken );
if ( *iter != *openToken )
{
Error::Error_1002_MatchingClosingTokenNotFound( openToken, nullptr, *openToken );
return false;
}
BFFIterator stringStart = openToken;
stringStart++;
// unescape and subsitute embedded variables
AStackString< 256 > value;
if ( PerformVariableSubstitutions( stringStart, iter, value ) == false )
{
return false;
}
iter++; // skip close token
BFFIterator varNameIter( value.Get(), value.GetLength(), iter.GetFileName().Get(), iter.GetFileTimeStamp() );
// sanity check it is a sensible length
if ( value.GetLength() + 1/* '.' will be added */ > MAX_VARIABLE_NAME_LENGTH )
{
Error::Error_1014_VariableNameIsTooLong( varNameIter, (uint32_t)value.GetLength(), (uint32_t)MAX_VARIABLE_NAME_LENGTH );
return false;
}
// sanity check it is a valid variable name
while ( varNameIter.IsAtEnd() == false )
{
if ( varNameIter.IsAtValidVariableNameCharacter() == false )
{
Error::Error_1013_UnexpectedCharInVariableName( varNameIter, nullptr );
return false;
}
varNameIter++;
}
// append '.' to variable name
name = ".";
name.Append( value );
}
else
{
// make sure immediately after the symbol starts a variable name
if ( iter.IsAtValidVariableNameCharacter() == false )
{
Error::Error_1013_UnexpectedCharInVariableName( iter, nullptr );
return false;
}
// find the end of the variable name
iter.SkipVariableName();
const BFFIterator varNameEnd = iter;
// sanity check it is a sensible length
size_t varNameLen = varNameStart.GetDistTo( varNameEnd );
if ( varNameLen > MAX_VARIABLE_NAME_LENGTH )
{
Error::Error_1014_VariableNameIsTooLong( iter, (uint32_t)varNameLen, (uint32_t)MAX_VARIABLE_NAME_LENGTH );
return false;
}
// store variable name
name.Assign( varNameStart.GetCurrent(), varNameEnd.GetCurrent() );
}
ASSERT( name.GetLength() > 0 );
if ( parentScope )
{
// exchange '^' with '.'
ASSERT( BFF_DECLARE_VAR_PARENT == name[0] );
name[0] = BFF_DECLARE_VAR_INTERNAL;
}
return true;
}