diff --git a/README b/README index f687777f1..34960f4f8 100644 --- a/README +++ b/README @@ -29,7 +29,6 @@ manual. 2) Run './configure' without options use standard locations and build in the Qt GUI. Use --prefix to specify the install location - Use --with-gui to specify a different gui (currently 'qt', 'gtk', or 'none') Use --with-qt=framework to use native Qt installation from TrollTech on Macs, otherwise use --with-qt=fink to use the Fink-installed version. Leave blank to take your chances! diff --git a/TODO b/TODO index c72e6be08..d520649d7 100644 --- a/TODO +++ b/TODO @@ -2,9 +2,6 @@

Current TODO

diff --git a/data/filters/gromacs b/data/filters/gromacs index 16f7ee9e0..169527a29 100644 --- a/data/filters/gromacs +++ b/data/filters/gromacs @@ -144,7 +144,7 @@ filter(type="exportexpression",name="Gromacs .top File", extension="top", glob=" { ++nfailed[1]; printf("Bond potential form '%s' not supported by GROMACS.\n", b.form); - writeLineF("%6i %6i 0 %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.data(1), b.data(2), b.data(3)); + writeLineF("%6i %6i 0 %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.data[1], b.data[2], b.data[3]); } } @@ -171,7 +171,7 @@ filter(type="exportexpression",name="Gromacs .top File", extension="top", glob=" { ++nfailed[2]; printf("Angle potential form '%s' not supported by GROMACS.\n", b.form); - writeLineF("%6i %6i %6i 0 %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.id[3], b.data(1), b.data(2), b.data(3)); + writeLineF("%6i %6i %6i 0 %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.id[3], b.data[1], b.data[2], b.data[3]); } } @@ -198,7 +198,7 @@ filter(type="exportexpression",name="Gromacs .top File", extension="top", glob=" { ++nfailed[3]; printf("Torsion potential form '%s' not supported by GROMACS.\n", b.form); - writeLineF("%6i %6i %6i %6i 0 %9.5f %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.id[3], b.id[4], b.data(1), b.data(2), b.data(3), b.data(4)); + writeLineF("%6i %6i %6i %6i 0 %9.5f %9.5f %9.5f %9.5f\n", b.id[1], b.id[2], b.id[3], b.id[4], b.data[1], b.data[2], b.data[3], b.data[4]); } } diff --git a/src/main/version.h b/src/main/version.h index b2854d4d3..834a6d500 100644 --- a/src/main/version.h +++ b/src/main/version.h @@ -23,8 +23,8 @@ #define ATEN_VERSION_H #define ATENVERSION "1.8" -#define ATENREVISION "1755" -#define ATENDATE "Thu 10 Nov - 09:57" +#define ATENREVISION "1756" +#define ATENDATE "Thu 10 Nov - 21:43" #define ATENURL "http://aten.googlecode.com/svn/trunk" #endif diff --git a/src/model/typing.cpp b/src/model/typing.cpp index 56e404f3a..f8ad4c313 100644 --- a/src/model/typing.cpp +++ b/src/model/typing.cpp @@ -137,12 +137,24 @@ bool Model::typeAll() createPatterns(); if (!arePatternsValid()) { - msg.print("Atom typing cannot be performed without valid patterns.\n Check pattern definition.\n"); + msg.print("Atom typing cannot be performed without valid patterns.\nCheck pattern definition, atom ordering, and bond consistency between atoms, or add the default (1*N) pattern for a quick fix.\n"); msg.exit("Model::typeAll"); return FALSE; } - if (forcefield_ == NULL) msg.print("Typing all patterns in model '%s' (no forcefield associated -- using default)...\n", name_.get()); - else msg.print("Typing all patterns in model '%s' (associated forcefield is '%s')...\n", name_.get(), forcefield_->name()); + + // If no forcefield is set in this model, grab it from the current default forcefield + if (forcefield_ == NULL) + { + if (aten.currentForcefield() != NULL) setForcefield(aten.currentForcefield()); + else + { + msg.print("Error: No forcefield set in model, and no default forcefield is available.\n"); + msg.exit("Model::typeAll"); + return FALSE; + } + } + msg.print("Typing all patterns in model '%s' (associated forcefield is '%s')...\n", name_.get(), forcefield_->name()); + // Assign forcefield types to atoms for (Pattern *p = patterns_.first(); p != NULL; p = p->next) { diff --git a/src/parser/aten.cpp b/src/parser/aten.cpp index 694e9692a..e696e46be 100644 --- a/src/parser/aten.cpp +++ b/src/parser/aten.cpp @@ -122,7 +122,7 @@ StepNode *AtenVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'aten&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Aten&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("AtenVariable::accessorSearch"); return NULL; @@ -130,7 +130,7 @@ StepNode *AtenVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'aten&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Aten&' function '%s'.\n", s); msg.exit("AtenVariable::accessorSearch"); return NULL; } @@ -139,7 +139,7 @@ StepNode *AtenVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'aten&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Aten&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -153,7 +153,14 @@ StepNode *AtenVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::AtenData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Aten&' array member '%s'.\n", s); + msg.exit("AtenVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::AtenData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("AtenVariable::accessorSearch"); return result; diff --git a/src/parser/atom.cpp b/src/parser/atom.cpp index 59e11c484..4470257d0 100644 --- a/src/parser/atom.cpp +++ b/src/parser/atom.cpp @@ -108,7 +108,7 @@ StepNode *AtomVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'atom&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Atom&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("AtomVariable::accessorSearch"); return NULL; @@ -116,7 +116,7 @@ StepNode *AtomVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'atom&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Atom&' function '%s'.\n", s); msg.exit("AtomVariable::accessorSearch"); return NULL; } @@ -125,7 +125,7 @@ StepNode *AtomVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'atom&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Atom&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -139,7 +139,14 @@ StepNode *AtomVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::AtomData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Atom&' array member '%s'.\n", s); + msg.exit("AtomVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::AtomData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("AtomVariable::accessorSearch"); return result; diff --git a/src/parser/basisprimitive.cpp b/src/parser/basisprimitive.cpp index c8d89f5c7..7bb656e4d 100644 --- a/src/parser/basisprimitive.cpp +++ b/src/parser/basisprimitive.cpp @@ -1,6 +1,6 @@ /* *** BasisPrimitive Variable and Array - *** src/parser/basisprimitive.cpp + *** src/parser/BasisPrimitive.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -80,7 +80,7 @@ StepNode *BasisPrimitiveVariable::accessorSearch(const char *s, TreeNode *arrayi i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'basisprimitive&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'BasisPrimitive&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("BasisPrimitiveVariable::accessorSearch"); return NULL; @@ -88,7 +88,7 @@ StepNode *BasisPrimitiveVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'basisprimitive&' function '%s'.\n", s); + msg.print("Error: Array index given to 'BasisPrimitive&' function '%s'.\n", s); msg.exit("BasisPrimitiveVariable::accessorSearch"); return NULL; } @@ -97,7 +97,7 @@ StepNode *BasisPrimitiveVariable::accessorSearch(const char *s, TreeNode *arrayi result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'basisprimitive&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'BasisPrimitive&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -111,7 +111,14 @@ StepNode *BasisPrimitiveVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::BasisPrimitiveData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'BasisPrimitive&' array member '%s'.\n", s); + msg.exit("BasisPrimitiveVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::BasisPrimitiveData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("BasisPrimitiveVariable::accessorSearch"); return result; diff --git a/src/parser/basisshell.cpp b/src/parser/basisshell.cpp index 5268d490d..9b5328263 100644 --- a/src/parser/basisshell.cpp +++ b/src/parser/basisshell.cpp @@ -1,6 +1,6 @@ /* *** BasisShell Variable and Array - *** src/parser/basisshell.cpp + *** src/parser/BasisShell.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -82,7 +82,7 @@ StepNode *BasisShellVariable::accessorSearch(const char *s, TreeNode *arrayindex i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'basisshell&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'BasisShell&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("BasisShellVariable::accessorSearch"); return NULL; @@ -90,7 +90,7 @@ StepNode *BasisShellVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'basisshell&' function '%s'.\n", s); + msg.print("Error: Array index given to 'BasisShell&' function '%s'.\n", s); msg.exit("BasisShellVariable::accessorSearch"); return NULL; } @@ -99,7 +99,7 @@ StepNode *BasisShellVariable::accessorSearch(const char *s, TreeNode *arrayindex result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'basisshell&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'BasisShell&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -113,7 +113,14 @@ StepNode *BasisShellVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::BasisShellData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'BasisShell&' array member '%s'.\n", s); + msg.exit("BasisShellVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::BasisShellData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("BasisShellVariable::accessorSearch"); return result; diff --git a/src/parser/bond.cpp b/src/parser/bond.cpp index e1a2322b1..916615688 100644 --- a/src/parser/bond.cpp +++ b/src/parser/bond.cpp @@ -83,7 +83,7 @@ StepNode *BondVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'bond&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Bond&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("BondVariable::accessorSearch"); return NULL; @@ -91,7 +91,7 @@ StepNode *BondVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'bond&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Bond&' function '%s'.\n", s); msg.exit("BondVariable::accessorSearch"); return NULL; } @@ -100,7 +100,7 @@ StepNode *BondVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'bond&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Bond&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -114,7 +114,14 @@ StepNode *BondVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::BondData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Bond&' array member '%s'.\n", s); + msg.exit("BondVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::BondData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("BondVariable::accessorSearch"); return result; diff --git a/src/parser/cell.cpp b/src/parser/cell.cpp index 67fca6ea4..821b32687 100644 --- a/src/parser/cell.cpp +++ b/src/parser/cell.cpp @@ -105,7 +105,7 @@ StepNode *CellVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'cell&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Cell&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("CellVariable::accessorSearch"); return NULL; @@ -113,7 +113,7 @@ StepNode *CellVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'cell&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Cell&' function '%s'.\n", s); msg.exit("CellVariable::accessorSearch"); return NULL; } @@ -122,7 +122,7 @@ StepNode *CellVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'cell&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Cell&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -136,7 +136,14 @@ StepNode *CellVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::CellData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Cell&' array member '%s'.\n", s); + msg.exit("CellVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::CellData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("CellVariable::accessorSearch"); return result; diff --git a/src/parser/colourscale.cpp b/src/parser/colourscale.cpp index 7314c5d68..21455a23b 100644 --- a/src/parser/colourscale.cpp +++ b/src/parser/colourscale.cpp @@ -1,6 +1,6 @@ /* *** ColourScale Variable and Array - *** src/parser/colourscale.cpp + *** src/parser/ColourScale.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -81,7 +81,7 @@ StepNode *ColourScaleVariable::accessorSearch(const char *s, TreeNode *arrayinde i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'colourscale&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'ColourScale&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ColourScaleVariable::accessorSearch"); return NULL; @@ -89,7 +89,7 @@ StepNode *ColourScaleVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'colourscale&' function '%s'.\n", s); + msg.print("Error: Array index given to 'ColourScale&' function '%s'.\n", s); msg.exit("ColourScaleVariable::accessorSearch"); return NULL; } @@ -98,7 +98,7 @@ StepNode *ColourScaleVariable::accessorSearch(const char *s, TreeNode *arrayinde result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'colourscale&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'ColourScale&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -112,7 +112,14 @@ StepNode *ColourScaleVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ColourScaleData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'ColourScale&' array member '%s'.\n", s); + msg.exit("ColourScalelVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ColourScaleData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ColourScaleVariable::accessorSearch"); return result; @@ -162,7 +169,7 @@ bool ColourScaleVariable::retrieveAccessor(int i, ReturnValue &rv, bool hasArray case (ColourScaleVariable::Point): if ((arrayIndex < 1) || (arrayIndex > ptr->nPoints())) { - msg.print("Array index %i is out of range for 'points' member in colourscale.\n"); + msg.print("Array index %i is out of range for 'points' member in ColourScale.\n"); result = FALSE; } else rv.set(VTypes::ColourScalePointData, ptr->point(arrayIndex-1)); diff --git a/src/parser/colourscalepoint.cpp b/src/parser/colourscalepoint.cpp index f0e0595ba..b3e8c5309 100644 --- a/src/parser/colourscalepoint.cpp +++ b/src/parser/colourscalepoint.cpp @@ -1,6 +1,6 @@ /* *** ColourScalePoint Variable and Array - *** src/parser/colourscalepoint.cpp + *** src/parser/ColourScalePoint.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -78,7 +78,7 @@ StepNode *ColourScalePointVariable::accessorSearch(const char *s, TreeNode *arra i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'colourscalepoint&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'ColourScalePoint&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ColourScalePointVariable::accessorSearch"); return NULL; @@ -86,7 +86,7 @@ StepNode *ColourScalePointVariable::accessorSearch(const char *s, TreeNode *arra msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'colourscalepoint&' function '%s'.\n", s); + msg.print("Error: Array index given to 'ColourScalePoint&' function '%s'.\n", s); msg.exit("ColourScalePointVariable::accessorSearch"); return NULL; } @@ -95,7 +95,7 @@ StepNode *ColourScalePointVariable::accessorSearch(const char *s, TreeNode *arra result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'colourscalepoint&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'ColourScalePoint&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -109,7 +109,14 @@ StepNode *ColourScalePointVariable::accessorSearch(const char *s, TreeNode *arra msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ColourScalePointData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'ColourScalePoint&' array member '%s'.\n", s); + msg.exit("ColourScalePointVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ColourScalePointData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ColourScalePointVariable::accessorSearch"); return result; diff --git a/src/parser/dialog.cpp b/src/parser/dialog.cpp index f5f6b1aac..8343ee8b6 100644 --- a/src/parser/dialog.cpp +++ b/src/parser/dialog.cpp @@ -101,7 +101,7 @@ StepNode *DialogVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'dialog&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Dialog&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("DialogVariable::accessorSearch"); return NULL; @@ -109,7 +109,7 @@ StepNode *DialogVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'dialog&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Dialog&' function '%s'.\n", s); msg.exit("DialogVariable::accessorSearch"); return NULL; } @@ -118,7 +118,7 @@ StepNode *DialogVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'dialog&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Dialog&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -132,7 +132,14 @@ StepNode *DialogVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::DialogData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Dialog&' array member '%s'.\n", s); + msg.exit("DialogVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::DialogData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("DialogVariable::accessorSearch"); return result; diff --git a/src/parser/eigenvector.cpp b/src/parser/eigenvector.cpp index 7c8c88cf1..5ecc0acc6 100644 --- a/src/parser/eigenvector.cpp +++ b/src/parser/eigenvector.cpp @@ -1,6 +1,6 @@ /* *** Eigenvector Variable and Array - *** src/parser/eigenvector.cpp + *** src/parser/EigenVector.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -84,7 +84,7 @@ StepNode *EigenvectorVariable::accessorSearch(const char *s, TreeNode *arrayinde i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'eigenvector&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'EigenVector&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("EigenvectorVariable::accessorSearch"); return NULL; @@ -92,7 +92,7 @@ StepNode *EigenvectorVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'eigenvector&' function '%s'.\n", s); + msg.print("Error: Array index given to 'EigenVector&' function '%s'.\n", s); msg.exit("EigenvectorVariable::accessorSearch"); return NULL; } @@ -101,7 +101,7 @@ StepNode *EigenvectorVariable::accessorSearch(const char *s, TreeNode *arrayinde result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'eigenvector&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'EigenVector&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -115,7 +115,14 @@ StepNode *EigenvectorVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::EigenvectorData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'EigenVector&' array member '%s'.\n", s); + msg.exit("EigenvectorVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::EigenvectorData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("EigenvectorVariable::accessorSearch"); return result; @@ -176,11 +183,11 @@ bool EigenvectorVariable::retrieveAccessor(int i, ReturnValue &rv, bool hasArray else rv.setArray(VTypes::DoubleData, ptr->eigenvector(), ptr->size()); break; default: - printf("Internal Error: Access to member '%s' has not been defined in EigenvectorVariable.\n", accessorData[i].name); + printf("Internal Error: Access to member '%s' has not been defined in EigenVectorVariable.\n", accessorData[i].name); result = FALSE; break; } - msg.exit("EigenvectorVariable::retrieveAccessor"); + msg.exit("EigenVectorVariable::retrieveAccessor"); return result; } diff --git a/src/parser/element.cpp b/src/parser/element.cpp index cd3989bae..8ef115a15 100644 --- a/src/parser/element.cpp +++ b/src/parser/element.cpp @@ -77,7 +77,7 @@ StepNode *ElementVariable::accessorSearch(const char *s, TreeNode *arrayindex, T i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'element&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Element&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ElementVariable::accessorSearch"); return NULL; @@ -85,7 +85,7 @@ StepNode *ElementVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'element&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Element&' function '%s'.\n", s); msg.exit("ElementVariable::accessorSearch"); return NULL; } @@ -94,7 +94,7 @@ StepNode *ElementVariable::accessorSearch(const char *s, TreeNode *arrayindex, T result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'element&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Element&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -108,7 +108,14 @@ StepNode *ElementVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ElementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Element&' array member '%s'.\n", s); + msg.exit("ElementVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ElementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ElementVariable::accessorSearch"); return result; diff --git a/src/parser/energystore.cpp b/src/parser/energystore.cpp index aa51b0c8f..777c57dd2 100644 --- a/src/parser/energystore.cpp +++ b/src/parser/energystore.cpp @@ -1,6 +1,6 @@ /* *** EnergyStore Variable and Array - *** src/parser/energystore.cpp + *** src/parser/EnergyStore.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -86,7 +86,7 @@ StepNode *EnergyStoreVariable::accessorSearch(const char *s, TreeNode *arrayinde i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'energystore&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'EnergyStore&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("EnergyStoreVariable::accessorSearch"); return NULL; @@ -94,7 +94,7 @@ StepNode *EnergyStoreVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'energystore&' function '%s'.\n", s); + msg.print("Error: Array index given to 'EnergyStore&' function '%s'.\n", s); msg.exit("EnergyStoreVariable::accessorSearch"); return NULL; } @@ -103,7 +103,7 @@ StepNode *EnergyStoreVariable::accessorSearch(const char *s, TreeNode *arrayinde result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'energystore&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'EnergyStore&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -117,7 +117,14 @@ StepNode *EnergyStoreVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::EnergyStoreData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'EnergyStore&' array member '%s'.\n", s); + msg.exit("EnergyStoreVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::EnergyStoreData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("EnergyStoreVariable::accessorSearch"); return result; diff --git a/src/parser/forcefield.cpp b/src/parser/forcefield.cpp index 44d4484d8..43b4c4a21 100644 --- a/src/parser/forcefield.cpp +++ b/src/parser/forcefield.cpp @@ -1,6 +1,6 @@ /* *** Forcefield Variable and Array - *** src/parser/forcefield.cpp + *** src/parser/Forcefield.cpp Copyright T. Youngs 2007-2011 This file is part of Aten. @@ -100,7 +100,7 @@ StepNode *ForcefieldVariable::accessorSearch(const char *s, TreeNode *arrayindex i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'forcefield&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Forcefield&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ForcefieldVariable::accessorSearch"); return NULL; @@ -108,7 +108,7 @@ StepNode *ForcefieldVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'forcefield&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Forcefield&' function '%s'.\n", s); msg.exit("ForcefieldVariable::accessorSearch"); return NULL; } @@ -117,7 +117,7 @@ StepNode *ForcefieldVariable::accessorSearch(const char *s, TreeNode *arrayindex result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'forcefield&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Forcefield&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -131,7 +131,14 @@ StepNode *ForcefieldVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ForcefieldData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Forcefield&' array member '%s'.\n", s); + msg.exit("ForcefieldVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ForcefieldData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ForcefieldVariable::accessorSearch"); return result; @@ -312,7 +319,7 @@ bool ForcefieldVariable::performFunction(int i, ReturnValue &rv, TreeNode *node) // Get current data from ReturnValue bool result = TRUE; Forcefield *ptr = (Forcefield*) rv.asPointer(VTypes::ForcefieldData, result); - // Construct temporary bundle object containing our forcefield pointer + // Construct temporary bundle object containing our Forcefield pointer Bundle bundle(ptr); if (result) switch (i) { diff --git a/src/parser/forcefieldatom.cpp b/src/parser/forcefieldatom.cpp index 2254816eb..bd55dd1c4 100644 --- a/src/parser/forcefieldatom.cpp +++ b/src/parser/forcefieldatom.cpp @@ -96,7 +96,7 @@ StepNode *ForcefieldAtomVariable::accessorSearch(const char *s, TreeNode *arrayi i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'ffatom&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'FFAtom&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ForcefieldAtomVariable::accessorSearch"); return NULL; @@ -104,7 +104,7 @@ StepNode *ForcefieldAtomVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'ffatom&' function '%s'.\n", s); + msg.print("Error: Array index given to 'FFAtom&' function '%s'.\n", s); msg.exit("ForcefieldAtomVariable::accessorSearch"); return NULL; } @@ -113,7 +113,7 @@ StepNode *ForcefieldAtomVariable::accessorSearch(const char *s, TreeNode *arrayi result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'ffatom&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'FFAtom&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -127,7 +127,14 @@ StepNode *ForcefieldAtomVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ForcefieldAtomData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'FFAtom&' array member '%s'.\n", s); + msg.exit("ForcefieldAtomVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ForcefieldAtomData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ForcefieldAtomVariable::accessorSearch"); return result; diff --git a/src/parser/forcefieldbound.cpp b/src/parser/forcefieldbound.cpp index b564eff87..633e0f4f1 100644 --- a/src/parser/forcefieldbound.cpp +++ b/src/parser/forcefieldbound.cpp @@ -88,7 +88,7 @@ StepNode *ForcefieldBoundVariable::accessorSearch(const char *s, TreeNode *array i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'ffbound&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'FFBound&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ForcefieldBoundVariable::accessorSearch"); return NULL; @@ -96,7 +96,7 @@ StepNode *ForcefieldBoundVariable::accessorSearch(const char *s, TreeNode *array msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'ffbound&' function '%s'.\n", s); + msg.print("Error: Array index given to 'FFBound&' function '%s'.\n", s); msg.exit("ForcefieldBoundVariable::accessorSearch"); return NULL; } @@ -105,7 +105,7 @@ StepNode *ForcefieldBoundVariable::accessorSearch(const char *s, TreeNode *array result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'ffbound&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'FFBound&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -119,7 +119,14 @@ StepNode *ForcefieldBoundVariable::accessorSearch(const char *s, TreeNode *array msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ForcefieldBoundData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'FFBound&' array member '%s'.\n", s); + msg.exit("ForcefieldBoundVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ForcefieldBoundData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ForcefieldBoundVariable::accessorSearch"); return result; diff --git a/src/parser/glyph.cpp b/src/parser/glyph.cpp index ee797a3f2..eb1509fd6 100644 --- a/src/parser/glyph.cpp +++ b/src/parser/glyph.cpp @@ -93,7 +93,7 @@ StepNode *GlyphVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'glyph&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Glyph&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("GlyphVariable::accessorSearch"); return NULL; @@ -101,7 +101,7 @@ StepNode *GlyphVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'glyph&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Glyph&' function '%s'.\n", s); msg.exit("GlyphVariable::accessorSearch"); return NULL; } @@ -110,7 +110,7 @@ StepNode *GlyphVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'glyph&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Glyph&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -124,7 +124,14 @@ StepNode *GlyphVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::GlyphData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Glyph&' array member '%s'.\n", s); + msg.exit("GlyphVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::GlyphData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("GlyphVariable::accessorSearch"); return result; diff --git a/src/parser/glyphdata.cpp b/src/parser/glyphdata.cpp index de4d5a49f..614e5c5ac 100644 --- a/src/parser/glyphdata.cpp +++ b/src/parser/glyphdata.cpp @@ -83,7 +83,7 @@ StepNode *GlyphDataVariable::accessorSearch(const char *s, TreeNode *arrayindex, i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'glyphdata&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'GlyphData&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("GlyphDataVariable::accessorSearch"); return NULL; @@ -91,7 +91,7 @@ StepNode *GlyphDataVariable::accessorSearch(const char *s, TreeNode *arrayindex, msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'glyphdata&' function '%s'.\n", s); + msg.print("Error: Array index given to 'GlyphData&' function '%s'.\n", s); msg.exit("GlyphDataVariable::accessorSearch"); return NULL; } @@ -100,7 +100,7 @@ StepNode *GlyphDataVariable::accessorSearch(const char *s, TreeNode *arrayindex, result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'glyphdata&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'GlyphData&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -114,7 +114,14 @@ StepNode *GlyphDataVariable::accessorSearch(const char *s, TreeNode *arrayindex, msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::GlyphDataData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'GlyphData&' array member '%s'.\n", s); + msg.exit("GlyphDataVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::GlyphDataData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("GlyphDataVariable::accessorSearch"); return result; diff --git a/src/parser/grammar.cc b/src/parser/grammar.cc index 58d90344b..fad368047 100644 --- a/src/parser/grammar.cc +++ b/src/parser/grammar.cc @@ -603,21 +603,21 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 90, 90, 91, 96, 99, 109, 110, 111, 112, - 121, 125, 129, 133, 141, 142, 143, 148, 152, 156, - 160, 164, 164, 169, 180, 185, 190, 198, 203, 208, - 220, 231, 232, 233, 238, 239, 240, 241, 242, 243, + 0, 80, 80, 81, 86, 89, 99, 100, 101, 102, + 111, 115, 119, 123, 131, 132, 133, 138, 142, 146, + 150, 154, 154, 159, 170, 175, 180, 188, 193, 198, + 210, 221, 222, 223, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 273, 277, 280, 292, 297, - 302, 307, 312, 317, 322, 331, 335, 339, 343, 351, - 355, 359, 366, 369, 372, 380, 384, 392, 395, 398, - 406, 411, 416, 428, 434, 434, 442, 448, 448, 464, - 467, 470, 473, 476, 479, 482, 485, 488, 491, 494, - 497, 500, 507, 510, 518, 521, 528, 531, 538, 541, - 544, 547, 550, 550, 557, 557, 573, 577, 581, 581, - 595, 604, 611, 614, 617, 628, 632, 640, 652, 656, - 660, 664, 668, 672, 676, 684, 691, 695 + 254, 255, 256, 257, 258, 263, 267, 270, 282, 287, + 292, 297, 302, 307, 312, 321, 325, 329, 333, 341, + 345, 349, 356, 359, 362, 370, 374, 382, 385, 388, + 396, 401, 406, 418, 424, 424, 432, 438, 438, 454, + 457, 460, 463, 466, 469, 472, 475, 478, 481, 484, + 487, 490, 497, 500, 508, 511, 518, 521, 528, 531, + 534, 537, 540, 540, 547, 547, 563, 567, 571, 571, + 585, 594, 601, 604, 607, 618, 622, 630, 642, 646, + 650, 654, 658, 662, 666, 674, 681, 685 }; #endif @@ -1929,21 +1929,21 @@ yyparse () case 2: /* Line 1455 of yacc.c */ -#line 90 "grammar.yy" +#line 80 "grammar.yy" { } break; case 3: /* Line 1455 of yacc.c */ -#line 91 "grammar.yy" +#line 81 "grammar.yy" { } break; case 4: /* Line 1455 of yacc.c */ -#line 96 "grammar.yy" +#line 86 "grammar.yy" { if (((yyvsp[(1) - (1)].node) != NULL) && (!cmdparser.addStatement((yyvsp[(1) - (1)].node)))) YYABORT; } @@ -1952,7 +1952,7 @@ yyparse () case 5: /* Line 1455 of yacc.c */ -#line 99 "grammar.yy" +#line 89 "grammar.yy" { if (((yyvsp[(1) - (1)].node) != NULL) && (!cmdparser.addStatement((yyvsp[(1) - (1)].node)))) YYABORT; } @@ -1961,35 +1961,35 @@ yyparse () case 6: /* Line 1455 of yacc.c */ -#line 109 "grammar.yy" +#line 99 "grammar.yy" { (yyval.node) = cmdparser.addConstant((yyvsp[(1) - (1)].intconst)); } break; case 7: /* Line 1455 of yacc.c */ -#line 110 "grammar.yy" +#line 100 "grammar.yy" { (yyval.node) = cmdparser.addConstant((yyvsp[(1) - (1)].doubleconst)); } break; case 8: /* Line 1455 of yacc.c */ -#line 111 "grammar.yy" +#line 101 "grammar.yy" { (yyval.node) = cmdparser.addConstant((yyvsp[(1) - (1)].name)->get()); } break; case 9: /* Line 1455 of yacc.c */ -#line 112 "grammar.yy" +#line 102 "grammar.yy" { (yyval.node) = cmdparser.addElementConstant((yyvsp[(1) - (1)].intconst)); } break; case 10: /* Line 1455 of yacc.c */ -#line 121 "grammar.yy" +#line 111 "grammar.yy" { if (!cmdparser.expandPath(stepNameStack.last(), (yyvsp[(4) - (5)].node))) YYABORT; stepNameStack.removeLast(); @@ -1999,7 +1999,7 @@ yyparse () case 11: /* Line 1455 of yacc.c */ -#line 125 "grammar.yy" +#line 115 "grammar.yy" { if (!cmdparser.expandPath(stepNameStack.last(), NULL, (yyvsp[(4) - (5)].node))) YYABORT; stepNameStack.removeLast(); @@ -2009,7 +2009,7 @@ yyparse () case 12: /* Line 1455 of yacc.c */ -#line 129 "grammar.yy" +#line 119 "grammar.yy" { if (!cmdparser.expandPath(stepNameStack.last(), NULL, NULL)) YYABORT; stepNameStack.removeLast(); @@ -2019,7 +2019,7 @@ yyparse () case 13: /* Line 1455 of yacc.c */ -#line 133 "grammar.yy" +#line 123 "grammar.yy" { if (!cmdparser.expandPath((yyvsp[(1) - (2)].name))) YYABORT; stepNameStack.removeLast(); @@ -2029,28 +2029,28 @@ yyparse () case 14: /* Line 1455 of yacc.c */ -#line 141 "grammar.yy" +#line 131 "grammar.yy" { } break; case 15: /* Line 1455 of yacc.c */ -#line 142 "grammar.yy" +#line 132 "grammar.yy" { } break; case 16: /* Line 1455 of yacc.c */ -#line 143 "grammar.yy" +#line 133 "grammar.yy" { msg.print("Error formulating path.\n"); YYABORT; } break; case 17: /* Line 1455 of yacc.c */ -#line 148 "grammar.yy" +#line 138 "grammar.yy" { (yyval.node) = cmdparser.wrapVariable((yyvsp[(1) - (4)].variable),(yyvsp[(3) - (4)].node)); if ((yyval.node) == NULL) { msg.print("Error in variable expression (code 1)\n"); YYABORT; } @@ -2060,7 +2060,7 @@ yyparse () case 18: /* Line 1455 of yacc.c */ -#line 152 "grammar.yy" +#line 142 "grammar.yy" { (yyval.node) = cmdparser.wrapVariable((yyvsp[(1) - (1)].variable)); if ((yyval.node) == NULL) { msg.print("Error in variable expression (code 2)\n"); YYABORT; } @@ -2070,7 +2070,7 @@ yyparse () case 19: /* Line 1455 of yacc.c */ -#line 156 "grammar.yy" +#line 146 "grammar.yy" { (yyval.node) = cmdparser.wrapVariable((yyvsp[(1) - (4)].variable),(yyvsp[(3) - (4)].node)); if ((yyval.node) == NULL) { msg.print("Error in variable expression (code 3)\n"); YYABORT; } @@ -2080,7 +2080,7 @@ yyparse () case 20: /* Line 1455 of yacc.c */ -#line 160 "grammar.yy" +#line 150 "grammar.yy" { (yyval.node) = cmdparser.wrapVariable((yyvsp[(1) - (1)].variable)); if ((yyval.node) == NULL) { msg.print("Error in variable expression (code 4)\n"); YYABORT; } @@ -2090,7 +2090,7 @@ yyparse () case 21: /* Line 1455 of yacc.c */ -#line 164 "grammar.yy" +#line 154 "grammar.yy" { cmdparser.createPath((yyvsp[(1) - (2)].node)); } @@ -2099,7 +2099,7 @@ yyparse () case 22: /* Line 1455 of yacc.c */ -#line 166 "grammar.yy" +#line 156 "grammar.yy" { (yyval.node) = cmdparser.finalisePath(); } @@ -2108,7 +2108,7 @@ yyparse () case 23: /* Line 1455 of yacc.c */ -#line 169 "grammar.yy" +#line 159 "grammar.yy" { msg.print("Can't use a variable as a function. Did you mean '[' instead?\n"); (yyval.node) = NULL; } @@ -2117,7 +2117,7 @@ yyparse () case 24: /* Line 1455 of yacc.c */ -#line 180 "grammar.yy" +#line 170 "grammar.yy" { (yyval.node) = cmdparser.addFunction( (Command::Function) (yyvsp[(1) - (3)].functionId)); if ((yyval.node) == NULL) YYABORT; @@ -2128,7 +2128,7 @@ yyparse () case 25: /* Line 1455 of yacc.c */ -#line 185 "grammar.yy" +#line 175 "grammar.yy" { (yyval.node) = cmdparser.addFunctionWithArglist( (Command::Function) (yyvsp[(1) - (4)].functionId),(yyvsp[(3) - (4)].node)); if ((yyval.node) == NULL) YYABORT; @@ -2139,7 +2139,7 @@ yyparse () case 26: /* Line 1455 of yacc.c */ -#line 190 "grammar.yy" +#line 180 "grammar.yy" { msg.print("Error: Missing brackets after function call?\n"); YYABORT; @@ -2149,7 +2149,7 @@ yyparse () case 27: /* Line 1455 of yacc.c */ -#line 198 "grammar.yy" +#line 188 "grammar.yy" { (yyval.node) = cmdparser.addUserFunction((yyvsp[(1) - (3)].tree)); if ((yyval.node) == NULL) YYABORT; @@ -2160,7 +2160,7 @@ yyparse () case 28: /* Line 1455 of yacc.c */ -#line 203 "grammar.yy" +#line 193 "grammar.yy" { (yyval.node) = cmdparser.addUserFunction((yyvsp[(1) - (4)].tree),(yyvsp[(3) - (4)].node)); if ((yyval.node) == NULL) YYABORT; @@ -2171,7 +2171,7 @@ yyparse () case 29: /* Line 1455 of yacc.c */ -#line 208 "grammar.yy" +#line 198 "grammar.yy" { msg.print("Error: Missing brackets after function call?\n"); YYABORT; @@ -2181,7 +2181,7 @@ yyparse () case 30: /* Line 1455 of yacc.c */ -#line 220 "grammar.yy" +#line 210 "grammar.yy" { (yyval.node) = cmdparser.addArrayConstant((yyvsp[(2) - (3)].node)); if ((yyval.node) == NULL) YYABORT; @@ -2191,245 +2191,245 @@ yyparse () case 31: /* Line 1455 of yacc.c */ -#line 231 "grammar.yy" +#line 221 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignment,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 32: /* Line 1455 of yacc.c */ -#line 232 "grammar.yy" +#line 222 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignment,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 33: /* Line 1455 of yacc.c */ -#line 233 "grammar.yy" +#line 223 "grammar.yy" { msg.print("Mangled expression used in assignment.\n"); YYABORT; } break; case 34: /* Line 1455 of yacc.c */ -#line 238 "grammar.yy" +#line 228 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); if ((yyval.node) == NULL) YYABORT; } break; case 35: /* Line 1455 of yacc.c */ -#line 239 "grammar.yy" +#line 229 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); if ((yyval.node) == NULL) YYABORT; } break; case 36: /* Line 1455 of yacc.c */ -#line 240 "grammar.yy" +#line 230 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); if ((yyval.node) == NULL) YYABORT; } break; case 37: /* Line 1455 of yacc.c */ -#line 241 "grammar.yy" +#line 231 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignmentPlus,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 38: /* Line 1455 of yacc.c */ -#line 242 "grammar.yy" +#line 232 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignmentSubtract,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 39: /* Line 1455 of yacc.c */ -#line 243 "grammar.yy" +#line 233 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignmentMultiply,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 40: /* Line 1455 of yacc.c */ -#line 244 "grammar.yy" +#line 234 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAssignmentDivide,(yyvsp[(1) - (3)].node),(yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 41: /* Line 1455 of yacc.c */ -#line 245 "grammar.yy" +#line 235 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorNegate, (yyvsp[(2) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 42: /* Line 1455 of yacc.c */ -#line 246 "grammar.yy" +#line 236 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorPostfixIncrease, (yyvsp[(1) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 43: /* Line 1455 of yacc.c */ -#line 247 "grammar.yy" +#line 237 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorPostfixDecrease, (yyvsp[(1) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 44: /* Line 1455 of yacc.c */ -#line 248 "grammar.yy" +#line 238 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorPrefixIncrease, (yyvsp[(2) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 45: /* Line 1455 of yacc.c */ -#line 249 "grammar.yy" +#line 239 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorPrefixDecrease, (yyvsp[(2) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 46: /* Line 1455 of yacc.c */ -#line 250 "grammar.yy" +#line 240 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); if ((yyval.node) == NULL) YYABORT; } break; case 47: /* Line 1455 of yacc.c */ -#line 251 "grammar.yy" +#line 241 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAdd, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 48: /* Line 1455 of yacc.c */ -#line 252 "grammar.yy" +#line 242 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorSubtract, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 49: /* Line 1455 of yacc.c */ -#line 253 "grammar.yy" +#line 243 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorMultiply, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 50: /* Line 1455 of yacc.c */ -#line 254 "grammar.yy" +#line 244 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorDivide, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 51: /* Line 1455 of yacc.c */ -#line 255 "grammar.yy" +#line 245 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorPower, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 52: /* Line 1455 of yacc.c */ -#line 256 "grammar.yy" +#line 246 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorModulus, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 53: /* Line 1455 of yacc.c */ -#line 257 "grammar.yy" +#line 247 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorEqualTo, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 54: /* Line 1455 of yacc.c */ -#line 258 "grammar.yy" +#line 248 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorNotEqualTo, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 55: /* Line 1455 of yacc.c */ -#line 259 "grammar.yy" +#line 249 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorGreaterThan, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 56: /* Line 1455 of yacc.c */ -#line 260 "grammar.yy" +#line 250 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorGreaterThanEqualTo, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 57: /* Line 1455 of yacc.c */ -#line 261 "grammar.yy" +#line 251 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorLessThan, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 58: /* Line 1455 of yacc.c */ -#line 262 "grammar.yy" +#line 252 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorLessThanEqualTo, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 59: /* Line 1455 of yacc.c */ -#line 263 "grammar.yy" +#line 253 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorAnd, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 60: /* Line 1455 of yacc.c */ -#line 264 "grammar.yy" +#line 254 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorOr, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 61: /* Line 1455 of yacc.c */ -#line 265 "grammar.yy" +#line 255 "grammar.yy" { (yyval.node) = (yyvsp[(2) - (3)].node); if ((yyval.node) == NULL) YYABORT; } break; case 62: /* Line 1455 of yacc.c */ -#line 266 "grammar.yy" +#line 256 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorNot, (yyvsp[(2) - (2)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 63: /* Line 1455 of yacc.c */ -#line 267 "grammar.yy" +#line 257 "grammar.yy" { (yyval.node) = cmdparser.addOperator(Command::OperatorInlineIf, (yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)); if ((yyval.node) == NULL) YYABORT; } break; case 64: /* Line 1455 of yacc.c */ -#line 268 "grammar.yy" +#line 258 "grammar.yy" { msg.print("Error: '%s' has not been declared as a function or a variable.\n", yylval.name->get()); YYABORT; } break; case 65: /* Line 1455 of yacc.c */ -#line 273 "grammar.yy" +#line 263 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); if ((yyval.node) == NULL) YYABORT; @@ -2439,7 +2439,7 @@ yyparse () case 66: /* Line 1455 of yacc.c */ -#line 277 "grammar.yy" +#line 267 "grammar.yy" { (yyval.node) = Tree::joinArguments((yyvsp[(3) - (3)].node),(yyvsp[(1) - (3)].node)); } @@ -2448,7 +2448,7 @@ yyparse () case 67: /* Line 1455 of yacc.c */ -#line 280 "grammar.yy" +#line 270 "grammar.yy" { msg.print("Error: Missing comma between items.\n"); YYABORT; @@ -2458,7 +2458,7 @@ yyparse () case 68: /* Line 1455 of yacc.c */ -#line 292 "grammar.yy" +#line 282 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : existing var '%s'\n", tokenName.get()); tokenName = yylval.variable->name(); @@ -2469,7 +2469,7 @@ yyparse () case 69: /* Line 1455 of yacc.c */ -#line 297 "grammar.yy" +#line 287 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : existing built-in function '%s'\n", tokenName.get()); tokenName = Command::data[yylval.functionId].keyword; @@ -2480,7 +2480,7 @@ yyparse () case 70: /* Line 1455 of yacc.c */ -#line 302 "grammar.yy" +#line 292 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : existing local var '%s'\n", tokenName.get()); msg.print("Error: Existing variable in local scope cannot be redeclared.\n"); @@ -2491,7 +2491,7 @@ yyparse () case 71: /* Line 1455 of yacc.c */ -#line 307 "grammar.yy" +#line 297 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : constant '%s'\n", tokenName.get()); msg.print("Error: Constant value found in declaration.\n"); @@ -2502,7 +2502,7 @@ yyparse () case 72: /* Line 1455 of yacc.c */ -#line 312 "grammar.yy" +#line 302 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : existing user function '%s'\n", tokenName.get()); msg.print("Error: Existing user-defined function name cannot be redeclared.\n"); @@ -2513,7 +2513,7 @@ yyparse () case 73: /* Line 1455 of yacc.c */ -#line 317 "grammar.yy" +#line 307 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : variable type-name '%s'\n", VTypes::dataType( yylval.vtype)); msg.print("Error: Type-name used in variable declaration.\n"); @@ -2524,7 +2524,7 @@ yyparse () case 74: /* Line 1455 of yacc.c */ -#line 322 "grammar.yy" +#line 312 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : variablename : new token '%s'\n", tokenName.get()); if (declaredType == VTypes::NoData) { msg.print("Token '%s' is undeclared.\n", tokenName.get()); YYABORT; } @@ -2535,7 +2535,7 @@ yyparse () case 75: /* Line 1455 of yacc.c */ -#line 331 "grammar.yy" +#line 321 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : var '%s' with array assignment\n", tokenName.get()); (yyval.node) = cmdparser.addVariable(declaredType, &tokenName, (yyvsp[(3) - (3)].node), globalDeclarations); @@ -2545,7 +2545,7 @@ yyparse () case 76: /* Line 1455 of yacc.c */ -#line 335 "grammar.yy" +#line 325 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : array var '%s' with expr assignment\n", tokenName.get()); (yyval.node) = cmdparser.addArrayVariable(declaredType, &tokenName, (yyvsp[(3) - (6)].node), (yyvsp[(6) - (6)].node), globalDeclarations); @@ -2555,7 +2555,7 @@ yyparse () case 77: /* Line 1455 of yacc.c */ -#line 339 "grammar.yy" +#line 329 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : array var '%s' with array assignment\n", tokenName.get()); (yyval.node) = cmdparser.addArrayVariable(declaredType, &tokenName, (yyvsp[(3) - (6)].node), (yyvsp[(6) - (6)].node), globalDeclarations); @@ -2565,7 +2565,7 @@ yyparse () case 78: /* Line 1455 of yacc.c */ -#line 343 "grammar.yy" +#line 333 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : var '%s' with expr assignment\n", tokenName.get()); (yyval.node) = cmdparser.addVariable(declaredType, &tokenName, (yyvsp[(3) - (3)].node), globalDeclarations); @@ -2575,7 +2575,7 @@ yyparse () case 79: /* Line 1455 of yacc.c */ -#line 351 "grammar.yy" +#line 341 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : var '%s'\n", tokenName.get()); (yyval.node) = cmdparser.addVariable(declaredType, &tokenName, NULL, globalDeclarations); @@ -2585,7 +2585,7 @@ yyparse () case 80: /* Line 1455 of yacc.c */ -#line 355 "grammar.yy" +#line 345 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : assignedvariablename : array var '%s'\n", tokenName.get()); (yyval.node) = cmdparser.addArrayVariable(declaredType, &tokenName, (yyvsp[(3) - (4)].node), NULL, globalDeclarations); @@ -2595,7 +2595,7 @@ yyparse () case 81: /* Line 1455 of yacc.c */ -#line 359 "grammar.yy" +#line 349 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2604,7 +2604,7 @@ yyparse () case 82: /* Line 1455 of yacc.c */ -#line 366 "grammar.yy" +#line 356 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2613,7 +2613,7 @@ yyparse () case 83: /* Line 1455 of yacc.c */ -#line 369 "grammar.yy" +#line 359 "grammar.yy" { (yyval.node) = Tree::joinArguments((yyvsp[(3) - (3)].node),(yyvsp[(1) - (3)].node)); } @@ -2622,7 +2622,7 @@ yyparse () case 84: /* Line 1455 of yacc.c */ -#line 372 "grammar.yy" +#line 362 "grammar.yy" { msg.print("Error: Missing comma between declarations?\n"); YYABORT; @@ -2632,7 +2632,7 @@ yyparse () case 85: /* Line 1455 of yacc.c */ -#line 380 "grammar.yy" +#line 370 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : typedvariablelistitem : var '%s'\n", tokenName.get()); (yyval.node) = cmdparser.addVariable(declaredType, &tokenName); @@ -2642,7 +2642,7 @@ yyparse () case 86: /* Line 1455 of yacc.c */ -#line 384 "grammar.yy" +#line 374 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : typedvariablelistitem : var '%s' with expr assignment\n", tokenName.get()); (yyval.node) = cmdparser.addVariable(declaredType, &tokenName, (yyvsp[(5) - (5)].node)); @@ -2652,7 +2652,7 @@ yyparse () case 87: /* Line 1455 of yacc.c */ -#line 392 "grammar.yy" +#line 382 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2661,7 +2661,7 @@ yyparse () case 88: /* Line 1455 of yacc.c */ -#line 395 "grammar.yy" +#line 385 "grammar.yy" { (yyval.node) = Tree::joinArguments((yyvsp[(3) - (3)].node),(yyvsp[(1) - (3)].node)); } @@ -2670,7 +2670,7 @@ yyparse () case 89: /* Line 1455 of yacc.c */ -#line 398 "grammar.yy" +#line 388 "grammar.yy" { msg.print("Error: Missing comma between declarations?\n"); YYABORT; @@ -2680,7 +2680,7 @@ yyparse () case 90: /* Line 1455 of yacc.c */ -#line 406 "grammar.yy" +#line 396 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : global declaration : standard variable declaration list\n"); (yyval.node) = cmdparser.addDeclarations((yyvsp[(5) - (6)].node)); @@ -2691,7 +2691,7 @@ yyparse () case 91: /* Line 1455 of yacc.c */ -#line 411 "grammar.yy" +#line 401 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : declaration : standard variable declaration list\n"); (yyval.node) = cmdparser.addDeclarations((yyvsp[(3) - (3)].node)); @@ -2702,7 +2702,7 @@ yyparse () case 92: /* Line 1455 of yacc.c */ -#line 416 "grammar.yy" +#line 406 "grammar.yy" { msg.print("Illegal use of reserved word '%s'.\n", VTypes::dataType(declaredType)); YYABORT; @@ -2712,7 +2712,7 @@ yyparse () case 93: /* Line 1455 of yacc.c */ -#line 428 "grammar.yy" +#line 418 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : functiondeclaration : user-defined subroutine (VOID return value, no arguments)\n"); if (!cmdparser.addStatement((yyvsp[(7) - (7)].node))) YYABORT; @@ -2724,7 +2724,7 @@ yyparse () case 94: /* Line 1455 of yacc.c */ -#line 434 "grammar.yy" +#line 424 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : functiondeclaration : user-defined subroutine (VOID return value, arguments)\n"); if (!(yyvsp[(4) - (7)].tree)->addLocalFunctionArguments((yyvsp[(6) - (7)].node))) YYABORT; @@ -2734,7 +2734,7 @@ yyparse () case 95: /* Line 1455 of yacc.c */ -#line 437 "grammar.yy" +#line 427 "grammar.yy" { if (!cmdparser.addStatement((yyvsp[(9) - (9)].node))) YYABORT; cmdparser.popTree(); @@ -2745,7 +2745,7 @@ yyparse () case 96: /* Line 1455 of yacc.c */ -#line 442 "grammar.yy" +#line 432 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : functiondeclaration : user-defined function (%s return value, no arguments)\n", VTypes::dataType((yyvsp[(4) - (7)].tree)->returnType())); if (!cmdparser.addStatement((yyvsp[(7) - (7)].node))) YYABORT; @@ -2757,7 +2757,7 @@ yyparse () case 97: /* Line 1455 of yacc.c */ -#line 448 "grammar.yy" +#line 438 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : functiondeclaration : user-defined function (%s return value, arguments)\n", VTypes::dataType((yyvsp[(4) - (7)].tree)->returnType())); if (!(yyvsp[(4) - (7)].tree)->addLocalFunctionArguments((yyvsp[(6) - (7)].node))) YYABORT; @@ -2767,7 +2767,7 @@ yyparse () case 98: /* Line 1455 of yacc.c */ -#line 451 "grammar.yy" +#line 441 "grammar.yy" { if (!cmdparser.addStatement((yyvsp[(9) - (9)].node))) YYABORT; cmdparser.popTree(); @@ -2778,7 +2778,7 @@ yyparse () case 99: /* Line 1455 of yacc.c */ -#line 464 "grammar.yy" +#line 454 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (2)].node); } @@ -2787,7 +2787,7 @@ yyparse () case 100: /* Line 1455 of yacc.c */ -#line 467 "grammar.yy" +#line 457 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (2)].node); } @@ -2796,7 +2796,7 @@ yyparse () case 101: /* Line 1455 of yacc.c */ -#line 470 "grammar.yy" +#line 460 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (2)].node); } @@ -2805,7 +2805,7 @@ yyparse () case 102: /* Line 1455 of yacc.c */ -#line 473 "grammar.yy" +#line 463 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (2)].node); } @@ -2814,7 +2814,7 @@ yyparse () case 103: /* Line 1455 of yacc.c */ -#line 476 "grammar.yy" +#line 466 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (2)].node); } @@ -2823,7 +2823,7 @@ yyparse () case 104: /* Line 1455 of yacc.c */ -#line 479 "grammar.yy" +#line 469 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2832,7 +2832,7 @@ yyparse () case 105: /* Line 1455 of yacc.c */ -#line 482 "grammar.yy" +#line 472 "grammar.yy" { (yyval.node) = NULL; } @@ -2841,7 +2841,7 @@ yyparse () case 106: /* Line 1455 of yacc.c */ -#line 485 "grammar.yy" +#line 475 "grammar.yy" { (yyval.node) = NULL; } @@ -2850,7 +2850,7 @@ yyparse () case 107: /* Line 1455 of yacc.c */ -#line 488 "grammar.yy" +#line 478 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Help, cmdparser.addConstant((yyvsp[(2) - (2)].functionId))); } @@ -2859,7 +2859,7 @@ yyparse () case 108: /* Line 1455 of yacc.c */ -#line 491 "grammar.yy" +#line 481 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Return,(yyvsp[(2) - (3)].node)); } @@ -2868,7 +2868,7 @@ yyparse () case 109: /* Line 1455 of yacc.c */ -#line 494 "grammar.yy" +#line 484 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Return); } @@ -2877,7 +2877,7 @@ yyparse () case 110: /* Line 1455 of yacc.c */ -#line 497 "grammar.yy" +#line 487 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Continue); } @@ -2886,7 +2886,7 @@ yyparse () case 111: /* Line 1455 of yacc.c */ -#line 500 "grammar.yy" +#line 490 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Break); } @@ -2895,7 +2895,7 @@ yyparse () case 112: /* Line 1455 of yacc.c */ -#line 507 "grammar.yy" +#line 497 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2904,7 +2904,7 @@ yyparse () case 113: /* Line 1455 of yacc.c */ -#line 510 "grammar.yy" +#line 500 "grammar.yy" { if ((yyvsp[(2) - (2)].node) == NULL) (yyval.node) = (yyvsp[(1) - (2)].node); else (yyval.node) = cmdparser.joinCommands((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); @@ -2914,7 +2914,7 @@ yyparse () case 114: /* Line 1455 of yacc.c */ -#line 518 "grammar.yy" +#line 508 "grammar.yy" { (yyval.node) = (yyvsp[(3) - (5)].node); } @@ -2923,7 +2923,7 @@ yyparse () case 115: /* Line 1455 of yacc.c */ -#line 521 "grammar.yy" +#line 511 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::NoFunction); } @@ -2932,7 +2932,7 @@ yyparse () case 116: /* Line 1455 of yacc.c */ -#line 528 "grammar.yy" +#line 518 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2941,7 +2941,7 @@ yyparse () case 117: /* Line 1455 of yacc.c */ -#line 531 "grammar.yy" +#line 521 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -2950,7 +2950,7 @@ yyparse () case 118: /* Line 1455 of yacc.c */ -#line 538 "grammar.yy" +#line 528 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::If,(yyvsp[(3) - (7)].node),(yyvsp[(5) - (7)].node),(yyvsp[(7) - (7)].node)); } @@ -2959,7 +2959,7 @@ yyparse () case 119: /* Line 1455 of yacc.c */ -#line 541 "grammar.yy" +#line 531 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::If,(yyvsp[(3) - (5)].node),(yyvsp[(5) - (5)].node)); } @@ -2968,7 +2968,7 @@ yyparse () case 120: /* Line 1455 of yacc.c */ -#line 544 "grammar.yy" +#line 534 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (10)].node), cmdparser.addFunction(Command::For, (yyvsp[(4) - (10)].node),(yyvsp[(6) - (10)].node),(yyvsp[(8) - (10)].node),(yyvsp[(10) - (10)].node))); cmdparser.popScope(); } @@ -2977,7 +2977,7 @@ yyparse () case 121: /* Line 1455 of yacc.c */ -#line 547 "grammar.yy" +#line 537 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (10)].node), cmdparser.addFunction(Command::For, (yyvsp[(4) - (10)].node),(yyvsp[(6) - (10)].node),(yyvsp[(8) - (10)].node),(yyvsp[(10) - (10)].node))); cmdparser.popScope(); } @@ -2986,7 +2986,7 @@ yyparse () case 122: /* Line 1455 of yacc.c */ -#line 550 "grammar.yy" +#line 540 "grammar.yy" { if ((yyvsp[(4) - (7)].node)->returnType() <= VTypes::VectorData) { msg.print("Error: For/In loop variable must be of pointer type.\n"); YYABORT; } if ((yyvsp[(4) - (7)].node)->returnType() != (yyvsp[(6) - (7)].node)->returnType()) { msg.print("Error: For/In loop variable is not being assigned the correct type.\n"); YYABORT; } @@ -2996,7 +2996,7 @@ yyparse () case 123: /* Line 1455 of yacc.c */ -#line 553 "grammar.yy" +#line 543 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (9)].node), cmdparser.addFunction(Command::ForIn,(yyvsp[(4) - (9)].node),(yyvsp[(6) - (9)].node),(yyvsp[(9) - (9)].node))); cmdparser.popScope(); @@ -3006,7 +3006,7 @@ yyparse () case 124: /* Line 1455 of yacc.c */ -#line 557 "grammar.yy" +#line 547 "grammar.yy" { if (declaredType <= VTypes::VectorData) { @@ -3025,7 +3025,7 @@ yyparse () case 125: /* Line 1455 of yacc.c */ -#line 569 "grammar.yy" +#line 559 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (11)].node), cmdparser.addFunction(Command::ForIn,tempNode,(yyvsp[(8) - (11)].node),(yyvsp[(11) - (11)].node))); cmdparser.popScope(); @@ -3035,7 +3035,7 @@ yyparse () case 126: /* Line 1455 of yacc.c */ -#line 573 "grammar.yy" +#line 563 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (6)].node), cmdparser.addFunction(Command::While, (yyvsp[(4) - (6)].node),(yyvsp[(6) - (6)].node))); cmdparser.popScope(); @@ -3045,7 +3045,7 @@ yyparse () case 127: /* Line 1455 of yacc.c */ -#line 577 "grammar.yy" +#line 567 "grammar.yy" { (yyval.node) = cmdparser.joinCommands((yyvsp[(2) - (8)].node), cmdparser.addFunction(Command::DoWhile, (yyvsp[(3) - (8)].node),(yyvsp[(6) - (8)].node))); cmdparser.popScope(); @@ -3055,7 +3055,7 @@ yyparse () case 128: /* Line 1455 of yacc.c */ -#line 581 "grammar.yy" +#line 571 "grammar.yy" { if (((yyvsp[(3) - (4)].node)->returnType() != VTypes::IntegerData) && ((yyvsp[(3) - (4)].node)->returnType() != VTypes::StringData)) { @@ -3068,7 +3068,7 @@ yyparse () case 129: /* Line 1455 of yacc.c */ -#line 587 "grammar.yy" +#line 577 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Switch, (yyvsp[(3) - (8)].node)); (yyval.node)->addJoinedArguments((yyvsp[(7) - (8)].node)); @@ -3078,7 +3078,7 @@ yyparse () case 130: /* Line 1455 of yacc.c */ -#line 595 "grammar.yy" +#line 585 "grammar.yy" { if (((yyvsp[(3) - (5)].node)->returnType() != VTypes::IntegerData) && ((yyvsp[(3) - (5)].node)->returnType() != VTypes::StringData)) { @@ -3093,7 +3093,7 @@ yyparse () case 131: /* Line 1455 of yacc.c */ -#line 604 "grammar.yy" +#line 594 "grammar.yy" { (yyval.node) = cmdparser.addFunction(Command::Default); } @@ -3102,7 +3102,7 @@ yyparse () case 132: /* Line 1455 of yacc.c */ -#line 611 "grammar.yy" +#line 601 "grammar.yy" { (yyval.node) = (yyvsp[(1) - (1)].node); } @@ -3111,7 +3111,7 @@ yyparse () case 133: /* Line 1455 of yacc.c */ -#line 614 "grammar.yy" +#line 604 "grammar.yy" { (yyval.node) = Tree::joinArguments((yyvsp[(2) - (2)].node),(yyvsp[(1) - (2)].node)); } @@ -3120,7 +3120,7 @@ yyparse () case 134: /* Line 1455 of yacc.c */ -#line 617 "grammar.yy" +#line 607 "grammar.yy" { (yyval.node) = Tree::joinArguments((yyvsp[(2) - (2)].node),(yyvsp[(1) - (2)].node)); } @@ -3129,7 +3129,7 @@ yyparse () case 135: /* Line 1455 of yacc.c */ -#line 628 "grammar.yy" +#line 618 "grammar.yy" { if (!cmdparser.setFilterOption(&tokenName, (yyvsp[(4) - (4)].node))) YYABORT; msg.print(Messenger::Parse,"PARSER : filteroptions : filter option '%s'\n", tokenName.get()); @@ -3139,7 +3139,7 @@ yyparse () case 136: /* Line 1455 of yacc.c */ -#line 632 "grammar.yy" +#line 622 "grammar.yy" { if (!cmdparser.setFilterOption(&tokenName, (yyvsp[(6) - (6)].node))) YYABORT; msg.print(Messenger::Parse,"PARSER : filteroptions : filter option '%s'\n", tokenName.get()); @@ -3149,7 +3149,7 @@ yyparse () case 137: /* Line 1455 of yacc.c */ -#line 640 "grammar.yy" +#line 630 "grammar.yy" { if (((yyvsp[(6) - (6)].node) != NULL) && (!cmdparser.addStatement((yyvsp[(6) - (6)].node)))) YYABORT; cmdparser.popTree(); @@ -3160,49 +3160,49 @@ yyparse () case 138: /* Line 1455 of yacc.c */ -#line 652 "grammar.yy" +#line 642 "grammar.yy" { tokenName = *yylval.name; } break; case 139: /* Line 1455 of yacc.c */ -#line 656 "grammar.yy" +#line 646 "grammar.yy" { declaredType = yylval.vtype; } break; case 140: /* Line 1455 of yacc.c */ -#line 660 "grammar.yy" +#line 650 "grammar.yy" { declaredType = VTypes::NoData; } break; case 141: /* Line 1455 of yacc.c */ -#line 664 "grammar.yy" +#line 654 "grammar.yy" { (yyval.node) = cmdparser.pushScope(); if ((yyval.node) == NULL) YYABORT; } break; case 142: /* Line 1455 of yacc.c */ -#line 668 "grammar.yy" +#line 658 "grammar.yy" { if (!cmdparser.popScope()) YYABORT; } break; case 143: /* Line 1455 of yacc.c */ -#line 672 "grammar.yy" +#line 662 "grammar.yy" { stepNameStack.add()->set(yylval.name->get()); } break; case 144: /* Line 1455 of yacc.c */ -#line 676 "grammar.yy" +#line 666 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : pushfunc : function/statement '%s'\n", yylval.name->get()); (yyval.tree) = cmdparser.pushFunction(yylval.name->get(), declaredType); @@ -3213,7 +3213,7 @@ yyparse () case 145: /* Line 1455 of yacc.c */ -#line 684 "grammar.yy" +#line 674 "grammar.yy" { msg.print(Messenger::Parse,"PARSER : pushfilter : new filter definition\n"); cmdparser.pushFilter(); @@ -3223,14 +3223,14 @@ yyparse () case 146: /* Line 1455 of yacc.c */ -#line 691 "grammar.yy" +#line 681 "grammar.yy" { globalDeclarations = TRUE; } break; case 147: /* Line 1455 of yacc.c */ -#line 695 "grammar.yy" +#line 685 "grammar.yy" { globalDeclarations = FALSE; } break; @@ -3449,7 +3449,7 @@ yyparse () /* Line 1675 of yacc.c */ -#line 698 "grammar.yy" +#line 688 "grammar.yy" void yyerror(char *s) diff --git a/src/parser/grammar.yy b/src/parser/grammar.yy index 5d935fd9f..55c0a7260 100644 --- a/src/parser/grammar.yy +++ b/src/parser/grammar.yy @@ -62,16 +62,6 @@ int globalDeclarations; %right UPLUS UMINUS '!' %left PLUSPLUS MINUSMINUS -/* %left AND OR */ -/* %left '=' PEQ MEQ TEQ DEQ */ -/* %left GEQ LEQ EQ NEQ '>' '<' */ -/* %left '+' '-' */ -/* %left '*' '/' '%' */ -/* %right UMINUS '?' ':' */ -/* %left PLUSPLUS MINUSMINUS */ -/* %right '!' */ -/* %right '^' */ - %type constant expression expressionlist variable statement flowstatement statementlist block blockment assignment %type declaration functiondeclaration caselabel caselist %type ARRAYCONST function userfunction assignedvariablename variablelistitem variablelist typedvariablelistitem typedvariablelist diff --git a/src/parser/grid.cpp b/src/parser/grid.cpp index 421484919..34066a396 100644 --- a/src/parser/grid.cpp +++ b/src/parser/grid.cpp @@ -99,7 +99,7 @@ StepNode *GridVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'grid&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Grid&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("GridVariable::accessorSearch"); return NULL; @@ -107,7 +107,7 @@ StepNode *GridVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'grid&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Grid&' function '%s'.\n", s); msg.exit("GridVariable::accessorSearch"); return NULL; } @@ -116,7 +116,7 @@ StepNode *GridVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'grid&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Grid&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -130,7 +130,14 @@ StepNode *GridVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::GridData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Grid&' array member '%s'.\n", s); + msg.exit("GridVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::GridData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("GridVariable::accessorSearch"); return result; diff --git a/src/parser/mc.cpp b/src/parser/mc.cpp index 2c5c885d6..33bf9e7cb 100644 --- a/src/parser/mc.cpp +++ b/src/parser/mc.cpp @@ -90,7 +90,7 @@ StepNode *MonteCarloVariable::accessorSearch(const char *s, TreeNode *arrayindex i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'mc&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'MC&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("MonteCarloVariable::accessorSearch"); return NULL; @@ -98,7 +98,7 @@ StepNode *MonteCarloVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'mc&' function '%s'.\n", s); + msg.print("Error: Array index given to 'MC&' function '%s'.\n", s); msg.exit("MonteCarloVariable::accessorSearch"); return NULL; } @@ -107,7 +107,7 @@ StepNode *MonteCarloVariable::accessorSearch(const char *s, TreeNode *arrayindex result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'mc&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'MC&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -121,7 +121,14 @@ StepNode *MonteCarloVariable::accessorSearch(const char *s, TreeNode *arrayindex msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::MonteCarloData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'MC&' array member '%s'.\n", s); + msg.exit("MonteCarloVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::MonteCarloData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("MonteCarloVariable::accessorSearch"); return result; diff --git a/src/parser/measurement.cpp b/src/parser/measurement.cpp index d0d61d407..b81663da3 100644 --- a/src/parser/measurement.cpp +++ b/src/parser/measurement.cpp @@ -84,7 +84,7 @@ StepNode *MeasurementVariable::accessorSearch(const char *s, TreeNode *arrayinde i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'measurement&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Measurement&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("MeasurementVariable::accessorSearch"); return NULL; @@ -92,7 +92,7 @@ StepNode *MeasurementVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'measurement&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Measurement&' function '%s'.\n", s); msg.exit("MeasurementVariable::accessorSearch"); return NULL; } @@ -101,7 +101,7 @@ StepNode *MeasurementVariable::accessorSearch(const char *s, TreeNode *arrayinde result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'measurement&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Measurement&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -115,7 +115,14 @@ StepNode *MeasurementVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::MeasurementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Measurement&' array member '%s'.\n", s); + msg.exit("MeasurementVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::MeasurementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("MeasurementVariable::accessorSearch"); return result; diff --git a/src/parser/model.cpp b/src/parser/model.cpp index 5561fa2c9..84787efb3 100644 --- a/src/parser/model.cpp +++ b/src/parser/model.cpp @@ -177,7 +177,7 @@ StepNode *ModelVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'model&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Model&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ModelVariable::accessorSearch"); return NULL; @@ -185,7 +185,7 @@ StepNode *ModelVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'model&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Model&' function '%s'.\n", s); msg.exit("ModelVariable::accessorSearch"); return NULL; } @@ -194,7 +194,7 @@ StepNode *ModelVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'model&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Model&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -208,7 +208,14 @@ StepNode *ModelVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tre msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ModelData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Model&' array member '%s'.\n", s); + msg.exit("ModelVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ModelData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ModelVariable::accessorSearch"); return result; diff --git a/src/parser/pattern.cpp b/src/parser/pattern.cpp index f50414afa..015381069 100644 --- a/src/parser/pattern.cpp +++ b/src/parser/pattern.cpp @@ -101,7 +101,7 @@ StepNode *PatternVariable::accessorSearch(const char *s, TreeNode *arrayindex, T i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'pattern&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Pattern&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("PatternVariable::accessorSearch"); return NULL; @@ -109,7 +109,7 @@ StepNode *PatternVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'pattern&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Pattern&' function '%s'.\n", s); msg.exit("PatternVariable::accessorSearch"); return NULL; } @@ -118,7 +118,7 @@ StepNode *PatternVariable::accessorSearch(const char *s, TreeNode *arrayindex, T result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'pattern&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Pattern&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -132,7 +132,14 @@ StepNode *PatternVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::PatternData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Pattern&' array member '%s'.\n", s); + msg.exit("PatternVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::PatternData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("PatternVariable::accessorSearch"); return result; diff --git a/src/parser/patternbound.cpp b/src/parser/patternbound.cpp index 3856b5177..9bd64d0e4 100644 --- a/src/parser/patternbound.cpp +++ b/src/parser/patternbound.cpp @@ -80,7 +80,7 @@ StepNode *PatternBoundVariable::accessorSearch(const char *s, TreeNode *arrayind i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'bound&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Bound&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("PatternBoundVariable::accessorSearch"); return NULL; @@ -88,7 +88,7 @@ StepNode *PatternBoundVariable::accessorSearch(const char *s, TreeNode *arrayind msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'bound&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Bound&' function '%s'.\n", s); msg.exit("PatternBoundVariable::accessorSearch"); return NULL; } @@ -97,7 +97,7 @@ StepNode *PatternBoundVariable::accessorSearch(const char *s, TreeNode *arrayind result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'bound&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Bound&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -111,7 +111,14 @@ StepNode *PatternBoundVariable::accessorSearch(const char *s, TreeNode *arrayind msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::PatternBoundData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Bound&' array member '%s'.\n", s); + msg.exit("PatternBoundVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::PatternBoundData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("PatternBoundVariable::accessorSearch"); return result; diff --git a/src/parser/prefs.cpp b/src/parser/prefs.cpp index adb061aea..a021200e4 100644 --- a/src/parser/prefs.cpp +++ b/src/parser/prefs.cpp @@ -174,7 +174,7 @@ StepNode *PreferencesVariable::accessorSearch(const char *s, TreeNode *arrayinde i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'prefs&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Prefs&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("PreferencesVariable::accessorSearch"); return NULL; @@ -182,7 +182,7 @@ StepNode *PreferencesVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'prefs&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Prefs&' function '%s'.\n", s); msg.exit("PreferencesVariable::accessorSearch"); return NULL; } @@ -191,7 +191,7 @@ StepNode *PreferencesVariable::accessorSearch(const char *s, TreeNode *arrayinde result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'prefs&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Prefs&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -205,7 +205,14 @@ StepNode *PreferencesVariable::accessorSearch(const char *s, TreeNode *arrayinde msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::PreferencesData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Prefs&' array member '%s'.\n", s); + msg.exit("PreferencesVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::PreferencesData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("PreferencesVariable::accessorSearch"); return result; diff --git a/src/parser/site.cpp b/src/parser/site.cpp index cd00af475..e53b91e18 100644 --- a/src/parser/site.cpp +++ b/src/parser/site.cpp @@ -80,7 +80,7 @@ StepNode *SiteVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'site&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Site&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("SiteVariable::accessorSearch"); return NULL; @@ -88,7 +88,7 @@ StepNode *SiteVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'site&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Site&' function '%s'.\n", s); msg.exit("SiteVariable::accessorSearch"); return NULL; } @@ -97,7 +97,7 @@ StepNode *SiteVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'site&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Site&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -111,7 +111,14 @@ StepNode *SiteVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tree msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::SiteData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Site&' array member '%s'.\n", s); + msg.exit("SiteVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::SiteData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("SiteVariable::accessorSearch"); return result; diff --git a/src/parser/tree.cpp b/src/parser/tree.cpp index 2fce2400d..c2580bc04 100644 --- a/src/parser/tree.cpp +++ b/src/parser/tree.cpp @@ -877,6 +877,12 @@ TreeNode *Tree::finalisePath() bool Tree::expandPath(Dnchar *name, TreeNode *arrayindex, TreeNode *arglist) { msg.enter("Tree::expandPath"); + // Check if both an arrayindex and an arglist were supplied, which is invalid + if ((arrayindex != NULL) && (arglist != NULL)) + { + printf("Internal Error: Both an array index and an argument list were provided for a path step.\n"); + return FALSE; + } // Get last item on path stack Refitem *ri = pathStack_.last(); if (ri == NULL) @@ -885,6 +891,7 @@ bool Tree::expandPath(Dnchar *name, TreeNode *arrayindex, TreeNode *arglist) return FALSE; } msg.print(Messenger::Parse,"Tree is evaluating accessor '%s' as step %i from the basenode '%s'...\n", name->get(), ri->item->nArgs()+1, ri->item->name()); + // If the last step was an array and an array index was not give, we complain! if (ri->item != ri->data) { @@ -896,6 +903,7 @@ bool Tree::expandPath(Dnchar *name, TreeNode *arrayindex, TreeNode *arglist) return FALSE; } } + // Find next step accessor StepNode *result = ri->data->findAccessor(name->get(), arrayindex, arglist); // If we found a valid accessor, update the pathstack entry diff --git a/src/parser/vector.cpp b/src/parser/vector.cpp index fe276b38c..d897b8ab4 100644 --- a/src/parser/vector.cpp +++ b/src/parser/vector.cpp @@ -164,14 +164,14 @@ StepNode *VectorVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'vector' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Vector' has no member or function named '%s'.\n", s); msg.exit("VectorVariable::accessorSearch"); return NULL; } msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'vector' function '%s'.\n", s); + msg.print("Error: Array index given to 'Vector' function '%s'.\n", s); msg.exit("VectorVariable::accessorSearch"); return NULL; } @@ -180,7 +180,7 @@ StepNode *VectorVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'vector' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Vector' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -194,6 +194,13 @@ StepNode *VectorVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Vector&' array member '%s'.\n", s); + msg.exit("VectorVariable::accessorSearch"); + return NULL; + } else result = new StepNode(i, VTypes::VectorData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("VectorVariable::accessorSearch"); diff --git a/src/parser/vibration.cpp b/src/parser/vibration.cpp index 5aff94aa4..d22582fab 100644 --- a/src/parser/vibration.cpp +++ b/src/parser/vibration.cpp @@ -82,7 +82,7 @@ StepNode *VibrationVariable::accessorSearch(const char *s, TreeNode *arrayindex, i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'vibration&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'Vibration&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("VibrationVariable::accessorSearch"); return NULL; @@ -90,7 +90,7 @@ StepNode *VibrationVariable::accessorSearch(const char *s, TreeNode *arrayindex, msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'vibration&' function '%s'.\n", s); + msg.print("Error: Array index given to 'Vibration&' function '%s'.\n", s); msg.exit("VibrationVariable::accessorSearch"); return NULL; } @@ -99,7 +99,7 @@ StepNode *VibrationVariable::accessorSearch(const char *s, TreeNode *arrayindex, result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'vibration&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'Vibration&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -113,7 +113,14 @@ StepNode *VibrationVariable::accessorSearch(const char *s, TreeNode *arrayindex, msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::VibrationData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Vibration&' array member '%s'.\n", s); + msg.exit("VibrationVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::VibrationData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("VibrationVariable::accessorSearch"); return result; diff --git a/src/parser/vtypes.cpp b/src/parser/vtypes.cpp index ce93547b9..820914715 100644 --- a/src/parser/vtypes.cpp +++ b/src/parser/vtypes.cpp @@ -27,7 +27,7 @@ #include // Variable Types -const char *DataTypeNames[VTypes::nDataTypes] = { "no data", "int", "double", "string", "vector", "Aten&", "Atom&", "BasisPrimitive&", "BasisShell&", "Bond&", "UnitCell&", "ColourScale&", "ColourScalePoint&", "Dialog&", "Eigenvector&", "Element&", "EnergyStore&", "Forcefield&", "FFAtom&", "FFBound&", "Glyph&", "Glyphdata&", "Grid&", "MC&", "Measurement&", "Model&", "Pattern&", "Bound&", "Prefs&", "Site&", "Vibration&", "Widget&", "ZMatrix&", "ZMatrixelement&" }; +const char *DataTypeNames[VTypes::nDataTypes] = { "no data", "int", "double", "string", "vector", "Aten&", "Atom&", "BasisPrimitive&", "BasisShell&", "Bond&", "UnitCell&", "ColourScale&", "ColourScalePoint&", "Dialog&", "Eigenvector&", "Element&", "EnergyStore&", "Forcefield&", "FFAtom&", "FFBound&", "Glyph&", "GlyphData&", "Grid&", "MC&", "Measurement&", "Model&", "Pattern&", "Bound&", "Prefs&", "Site&", "Vibration&", "Widget&", "ZMatrix&", "ZMatrixElement&" }; const char *DataTypePhrases[VTypes::nDataTypes] = { "no data", "an integer", "a double", "a string", "a vector", "Aten&", "an Atom&", "a BasisPrimitive&", "a BasisShell&", "a Bond&", "a UnitCell&", "a Colourscale&", "a ColourScalePoint&", "a Dialog&", "an Eigenvector&", "an Element&", "an EnergyStore&", "a Forcefield&", "a FFAtom&", "a FFBound&", "a Glyph&", "a GlyphData&", "a Grid&", "MC&", "a Measurement&", "a Model&", "a Pattern&", "a Bound&", "some Prefs&", "a Site", "a Vibration&", "a Widget&", "a ZMatrix&", "a ZMatrix element&" }; const char *DataTypeArrayPhrases[VTypes::nDataTypes] = { "no data", "an integer array", "a double array", "a string array", "a vector array", "an Aten& array", "an Atom& array", "a BasisPrimitive& array", "a BasisShell& array", "a Bond& array", "a UnitCell& array", "a Colourscale& array", "a ColourScalePoint& array", "a Dialog& array", "an Eigenvector& array", "an Element& array", "an EnergyStore& array", "a Forcefield& array", "a FFAtom& array", "a FFBound& array", "a Glyph& array", "a GlyphData& array", "a Grid& array", "a MC& array", "a Measurement& array", "a Model& array", "a Pattern& array", "a Bound& array", "a Prefs& array", "a Site& array", "a Vibration& array","a Widget& array", "a ZMatrix& array", "a ZMatrixElement& array" }; const char *DataTypeKeywords[VTypes::nDataTypes] = { "_NODATA", "int", "double", "string", "vector", "_ATEN", "Atom", "BasisPrimitive", "BasisShell", "Bond", "UnitCell", "ColourScale", "ColourScalePoint", "Dialog", "EigenVector", "Element", "EnergyStore", "Forcefield", "FFAtom", "FFBound", "Glyph", "_GLYPHDATA", "Grid", "_MC", "Measurement", "Model", "Pattern", "Bound", "_PREFS", "Site", "Vibration", "Widget", "ZMatrix", "ZMatrixElement" }; diff --git a/src/parser/widget.cpp b/src/parser/widget.cpp index 25831fc6b..4deedbe4e 100644 --- a/src/parser/widget.cpp +++ b/src/parser/widget.cpp @@ -124,7 +124,14 @@ StepNode *WidgetVariable::accessorSearch(const char *s, TreeNode *arrayindex, Tr msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::WidgetData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'Widget&' array member '%s'.\n", s); + msg.exit("WidgetVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::WidgetData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("WidgetVariable::accessorSearch"); return result; diff --git a/src/parser/zmatrix.cpp b/src/parser/zmatrix.cpp index 369fd315a..0a6e50593 100644 --- a/src/parser/zmatrix.cpp +++ b/src/parser/zmatrix.cpp @@ -89,7 +89,7 @@ StepNode *ZMatrixVariable::accessorSearch(const char *s, TreeNode *arrayindex, T i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'zmatrix&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'ZMatrix&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ZMatrixVariable::accessorSearch"); return NULL; @@ -97,7 +97,7 @@ StepNode *ZMatrixVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'zmatrix&' function '%s'.\n", s); + msg.print("Error: Array index given to 'ZMatrix&' function '%s'.\n", s); msg.exit("ZMatrixVariable::accessorSearch"); return NULL; } @@ -106,7 +106,7 @@ StepNode *ZMatrixVariable::accessorSearch(const char *s, TreeNode *arrayindex, T result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'zmatrix&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'ZMatrix&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -120,7 +120,14 @@ StepNode *ZMatrixVariable::accessorSearch(const char *s, TreeNode *arrayindex, T msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ZMatrixData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'ZMatrix&' array member '%s'.\n", s); + msg.exit("ZMatrixVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ZMatrixData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ZMatrixVariable::accessorSearch"); return result; diff --git a/src/parser/zmatrixelement.cpp b/src/parser/zmatrixelement.cpp index 8ea3e1e68..468442fe7 100644 --- a/src/parser/zmatrixelement.cpp +++ b/src/parser/zmatrixelement.cpp @@ -92,7 +92,7 @@ StepNode *ZMatrixElementVariable::accessorSearch(const char *s, TreeNode *arrayi i = Variable::searchAccessor(s, nFunctions, functionData); if (i == -1) { - msg.print("Error: Type 'zmatrixelement&' has no member or function named '%s'.\n", s); + msg.print("Error: Type 'ZMatrixElement&' has no member or function named '%s'.\n", s); printAccessors(); msg.exit("ZMatrixElementVariable::accessorSearch"); return NULL; @@ -100,7 +100,7 @@ StepNode *ZMatrixElementVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print(Messenger::Parse, "FunctionAccessor match = %i (%s)\n", i, functionData[i].name); if (arrayindex != NULL) { - msg.print("Error: Array index given to 'zmatrixelement&' function '%s'.\n", s); + msg.print("Error: Array index given to 'ZMatrixElement&' function '%s'.\n", s); msg.exit("ZMatrixElementVariable::accessorSearch"); return NULL; } @@ -109,7 +109,7 @@ StepNode *ZMatrixElementVariable::accessorSearch(const char *s, TreeNode *arrayi result->addJoinedArguments(arglist); if (!result->checkArguments(functionData[i].arguments, functionData[i].name)) { - msg.print("Error: Syntax for 'zmatrixelement&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); + msg.print("Error: Syntax for 'ZMatrixElement&' function '%s' is '%s(%s)'.\n", functionData[i].name, functionData[i].name, functionData[i].argText ); delete result; result = NULL; } @@ -123,7 +123,14 @@ StepNode *ZMatrixElementVariable::accessorSearch(const char *s, TreeNode *arrayi msg.print("Error: Irrelevant array index provided for member '%s'.\n", accessorData[i].name); result = NULL; } - else result = new StepNode(i, VTypes::ZMatrixElementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); + // Were we given an argument list when we didn't want one? + if (arglist != NULL) + { + msg.print("Error: Argument list given to 'ZMatrixElement&' array member '%s'.\n", s); + msg.exit("ZMatrixElementVariable::accessorSearch"); + return NULL; + } + result = new StepNode(i, VTypes::ZMatrixElementData, arrayindex, accessorData[i].returnType, accessorData[i].isReadOnly, accessorData[i].arraySize); } msg.exit("ZMatrixElementVariable::accessorSearch"); return result;