http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/DataExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataExpression.java 
b/src/main/java/org/apache/sysml/parser/DataExpression.java
index 1fa8fd3..d487020 100644
--- a/src/main/java/org/apache/sysml/parser/DataExpression.java
+++ b/src/main/java/org/apache/sysml/parser/DataExpression.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map.Entry;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -135,10 +136,15 @@ public class DataExpression extends DataIdentifier
                _checkMetadata = checkMetadata;
        }
 
+       public static DataExpression getDataExpression(ParserRuleContext ctx, 
String functionName,
+                       ArrayList<ParameterExpression> passedParamExprs, String 
filename, CustomErrorListener errorListener)
+                       throws LanguageException {
+               ParseInfo pi = ParseInfo.ctxAndFilenameToParseInfo(ctx, 
filename);
+               return getDataExpression(functionName, passedParamExprs, pi, 
errorListener);
+       }
 
-       public static DataExpression getDataExpression(String functionName, 
ArrayList<ParameterExpression> passedParamExprs, 
-                               String filename, int blp, int bcp, int elp, int 
ecp, CustomErrorListener errorListener) throws LanguageException
-       {       
+       public static DataExpression getDataExpression(String functionName, 
ArrayList<ParameterExpression> passedParamExprs,
+                       ParseInfo parseInfo, CustomErrorListener errorListener) 
throws LanguageException {
                if (functionName == null || passedParamExprs == null)
                        return null;
                
@@ -146,31 +152,28 @@ public class DataExpression extends DataIdentifier
                //       (assign built-in function op if function is built-in)
                Expression.DataOp dop = null;
                DataExpression dataExpr = null;
-               if (functionName.equals("read") || 
functionName.equals("readMM") || functionName.equals("read.csv"))
-               {
+               if (functionName.equals("read") || 
functionName.equals("readMM") || functionName.equals("read.csv")) {
                        dop = Expression.DataOp.READ;
-                       dataExpr = new DataExpression(dop, new 
HashMap<String,Expression>(), filename, blp, bcp, elp, ecp);
-                       
+                       dataExpr = new DataExpression(dop, new HashMap<String, 
Expression>(), parseInfo);
+
                        if (functionName.equals("readMM"))
-                               
dataExpr.addVarParam(DataExpression.FORMAT_TYPE,  
-                                               new 
StringIdentifier(DataExpression.FORMAT_TYPE_VALUE_MATRIXMARKET,
-                                                               filename, blp, 
bcp, elp, ecp));
-                       
+                               dataExpr.addVarParam(DataExpression.FORMAT_TYPE,
+                                               new 
StringIdentifier(DataExpression.FORMAT_TYPE_VALUE_MATRIXMARKET, parseInfo));
+
                        if (functionName.equals("read.csv"))
-                               
dataExpr.addVarParam(DataExpression.FORMAT_TYPE,  
-                                               new 
StringIdentifier(DataExpression.FORMAT_TYPE_VALUE_CSV, 
-                                                               filename, blp, 
bcp, elp, ecp));
-                       
+                               dataExpr.addVarParam(DataExpression.FORMAT_TYPE,
+                                               new 
StringIdentifier(DataExpression.FORMAT_TYPE_VALUE_CSV, parseInfo));
+
                        // validate the filename is the first parameter
                        if (passedParamExprs.size() < 1){
-                               errorListener.validationError(blp, bcp, "read 
method must have at least filename parameter");
+                               errorListener.validationError(parseInfo, "read 
method must have at least filename parameter");
                                return null;
                        }
                        
                        ParameterExpression pexpr = (passedParamExprs.size() == 
0) ? null : passedParamExprs.get(0);
                        
                        if ( (pexpr != null) &&  (!(pexpr.getName() == null) || 
(pexpr.getName() != null && 
pexpr.getName().equalsIgnoreCase(DataExpression.IO_FILENAME)))){
-                               errorListener.validationError(blp, bcp, "first 
parameter to read statement must be filename");
+                               errorListener.validationError(parseInfo, "first 
parameter to read statement must be filename");
                                return null;
                        } else if( pexpr != null ){
                                
dataExpr.addVarParam(DataExpression.IO_FILENAME, pexpr.getExpr());
@@ -182,7 +185,7 @@ public class DataExpression extends DataIdentifier
                                Expression currExpr = 
passedParamExprs.get(i).getExpr();
                                
                                if (dataExpr.getVarParam(currName) != null){
-                                       errorListener.validationError(blp, bcp, 
"attempted to add IOStatement parameter " + currName + " more than once");
+                                       
errorListener.validationError(parseInfo, "attempted to add IOStatement 
parameter " + currName + " more than once");
                                        return null;
                                }
                                // verify parameter names for read function
@@ -192,7 +195,7 @@ public class DataExpression extends DataIdentifier
                                                isValidName = true;
                                }
                                if (!isValidName){
-                                       errorListener.validationError(blp, bcp, 
"attempted to add invalid read statement parameter " + currName);
+                                       
errorListener.validationError(parseInfo, "attempted to add invalid read 
statement parameter " + currName);
                                        return null;
                                }       
                                dataExpr.addVarParam(currName, currExpr);
@@ -202,14 +205,13 @@ public class DataExpression extends DataIdentifier
                else if (functionName.equalsIgnoreCase("rand")){
                        
                        dop = Expression.DataOp.RAND;
-                       dataExpr = new DataExpression(dop, new 
HashMap<String,Expression>(), 
-                                       filename, blp, bcp, elp, ecp);
+                       dataExpr = new DataExpression(dop, new HashMap<String, 
Expression>(), parseInfo);
                        
                        for (ParameterExpression currExpr : passedParamExprs){
                                String pname = currExpr.getName();
                                Expression pexpr = currExpr.getExpr();
                                if (pname == null){
-                                       errorListener.validationError(blp, bcp, 
"for rand statement, all arguments must be named parameters");
+                                       
errorListener.validationError(parseInfo, "for rand statement, all arguments 
must be named parameters");
                                        return null;
                                }
                                dataExpr.addRandExprParam(pname, pexpr); 
@@ -219,8 +221,7 @@ public class DataExpression extends DataIdentifier
                
                else if (functionName.equals("matrix")){
                        dop = Expression.DataOp.MATRIX;
-                       dataExpr = new DataExpression(dop, new 
HashMap<String,Expression>(),
-                                       filename, blp, bcp, elp, ecp);
+                       dataExpr = new DataExpression(dop, new HashMap<String, 
Expression>(), parseInfo);
                
                        int namedParamCount = 0, unnamedParamCount = 0;
                        for (ParameterExpression currExpr : passedParamExprs) {
@@ -232,19 +233,19 @@ public class DataExpression extends DataIdentifier
 
                        // check whether named or unnamed parameters are used
                        if (passedParamExprs.size() < 3){
-                               errorListener.validationError(blp, bcp, "for 
matrix statement, must specify at least 3 arguments: data, rows, cols");
+                               errorListener.validationError(parseInfo, "for 
matrix statement, must specify at least 3 arguments: data, rows, cols");
                                return null;
                        }
                        
                        if (unnamedParamCount > 1){
                                
                                if (namedParamCount > 0) {
-                                       errorListener.validationError(blp, bcp, 
"for matrix statement, cannot mix named and unnamed parameters");
+                                       
errorListener.validationError(parseInfo, "for matrix statement, cannot mix 
named and unnamed parameters");
                                        return null;
                                }
                                
                                if (unnamedParamCount < 3) {
-                                       errorListener.validationError(blp, bcp, 
"for matrix statement, must specify at least 3 arguments: data, rows, cols");
+                                       
errorListener.validationError(parseInfo, "for matrix statement, must specify at 
least 3 arguments: data, rows, cols");
                                        return null;
                                }
                                
@@ -261,7 +262,7 @@ public class DataExpression extends DataIdentifier
                                        
dataExpr.addMatrixExprParam(DataExpression.RAND_DIMNAMES,passedParamExprs.get(4).getExpr());
                                
                                if (unnamedParamCount > 5) {
-                                       errorListener.validationError(blp, bcp, 
"for matrix statement, at most 5 arguments supported: data, rows, cols, byrow, 
dimname");
+                                       
errorListener.validationError(parseInfo, "for matrix statement, at most 5 
arguments supported: data, rows, cols, byrow, dimname");
                                        return null;
                                }
                                
@@ -269,7 +270,7 @@ public class DataExpression extends DataIdentifier
                                // handle first parameter, which is data and 
may be unnamed
                                ParameterExpression firstParam = 
passedParamExprs.get(0);
                                if (firstParam.getName() != null && 
!firstParam.getName().equals(DataExpression.RAND_DATA)){
-                                       errorListener.validationError(blp, bcp, 
"matrix method must have data parameter as first parameter or unnamed 
parameter");
+                                       
errorListener.validationError(parseInfo, "matrix method must have data 
parameter as first parameter or unnamed parameter");
                                        return null;
                                } else {
                                        
dataExpr.addMatrixExprParam(DataExpression.RAND_DATA, 
passedParamExprs.get(0).getExpr());
@@ -277,7 +278,7 @@ public class DataExpression extends DataIdentifier
                                
                                for (int i=1; i<passedParamExprs.size(); i++){
                                        if (passedParamExprs.get(i).getName() 
== null){
-                                               
errorListener.validationError(blp, bcp, "for matrix statement, cannot mix named 
and unnamed parameters, only data parameter can be unnammed");
+                                               
errorListener.validationError(parseInfo, "for matrix statement, cannot mix 
named and unnamed parameters, only data parameter can be unnammed");
                                                return null;
                                        } else {
                                                
dataExpr.addMatrixExprParam(passedParamExprs.get(i).getName(), 
passedParamExprs.get(i).getExpr());
@@ -286,9 +287,9 @@ public class DataExpression extends DataIdentifier
                        }
                        dataExpr.setMatrixDefault();
                }
-               
+
                if (dataExpr != null) {
-                       dataExpr.setAllPositions(filename, blp, bcp, elp, ecp);
+                       dataExpr.setParseInfo(parseInfo);
                }
                return dataExpr;
        
@@ -321,19 +322,13 @@ public class DataExpression extends DataIdentifier
                        raiseValidateError("attempted to add Rand statement 
parameter " + paramValue + " more than once");
                }
                // Process the case where user provides double values to rows 
or cols
-               if (paramName.equals(RAND_ROWS) && paramValue instanceof 
DoubleIdentifier){
-                       paramValue = new 
IntIdentifier((long)((DoubleIdentifier)paramValue).getValue(), 
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (paramName.equals(RAND_ROWS) && paramValue instanceof 
DoubleIdentifier) {
+                       paramValue = new IntIdentifier((long) 
((DoubleIdentifier) paramValue).getValue(), this);
+               } else if (paramName.equals(RAND_COLS) && paramValue instanceof 
DoubleIdentifier) {
+                       paramValue = new IntIdentifier((long) 
((DoubleIdentifier) paramValue).getValue(), this);
                }
-               else if (paramName.equals(RAND_COLS) && paramValue instanceof 
DoubleIdentifier){
-                       paramValue = new 
IntIdentifier((long)((DoubleIdentifier)paramValue).getValue(),
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
-               }
-                       
                // add the parameter to expression list
-               paramValue.setAllPositions(this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(), this.getEndLine(), 
this.getEndColumn());
+               paramValue.setParseInfo(this);
                addVarParam(paramName,paramValue);
                
        }
@@ -361,27 +356,28 @@ public class DataExpression extends DataIdentifier
                        raiseValidateError("attempted to add matrix statement 
parameter " + paramValue + " more than once");
                }
                // Process the case where user provides double values to rows 
or cols
-               if (paramName.equals(RAND_ROWS) && paramValue instanceof 
DoubleIdentifier){
-                       paramValue = new 
IntIdentifier((long)((DoubleIdentifier)paramValue).getValue(),
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (paramName.equals(RAND_ROWS) && paramValue instanceof 
DoubleIdentifier) {
+                       paramValue = new IntIdentifier((long) 
((DoubleIdentifier) paramValue).getValue(), this);
+               } else if (paramName.equals(RAND_COLS) && paramValue instanceof 
DoubleIdentifier) {
+                       paramValue = new IntIdentifier((long) 
((DoubleIdentifier) paramValue).getValue(), this);
                }
-               else if (paramName.equals(RAND_COLS) && paramValue instanceof 
DoubleIdentifier){
-                       paramValue = new 
IntIdentifier((long)((DoubleIdentifier)paramValue).getValue(),
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
-               }
-                       
+
                // add the parameter to expression list
-               paramValue.setAllPositions(this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(), this.getEndLine(), 
this.getEndColumn());
+               paramValue.setParseInfo(this);
                addVarParam(paramName,paramValue);
        }
-       
-       public DataExpression(DataOp op, HashMap<String,Expression> varParams, 
-                       String filename, int blp, int bcp, int elp, int ecp) {
+
+       public DataExpression(DataOp op, HashMap<String, Expression> varParams, 
ParseInfo parseInfo) {
+               _opcode = op;
+               _varParams = varParams;
+               setParseInfo(parseInfo);
+       }
+
+       public DataExpression(ParserRuleContext ctx, DataOp op, 
HashMap<String,Expression> varParams, 
+                       String filename) {
                _opcode = op;
                _varParams = varParams;
-               setAllPositions(filename, blp, bcp, elp, ecp);
+               setCtxValuesAndFilename(ctx, filename);
        }
 
        public Expression rewriteExpression(String prefix) throws 
LanguageException {
@@ -392,9 +388,7 @@ public class DataExpression extends DataIdentifier
                        Expression newExpr = 
e.getValue().rewriteExpression(prefix);
                        newVarParams.put(key, newExpr);
                }       
-               DataExpression retVal = new DataExpression(_opcode, 
newVarParams,
-                               this.getFilename(), this.getBeginLine(), 
this.getBeginColumn(), this.getEndLine(), this.getEndColumn());
-               
+               DataExpression retVal = new DataExpression(_opcode, 
newVarParams, this);
                retVal._strInit = this._strInit;
                
                return retVal;
@@ -407,63 +401,44 @@ public class DataExpression extends DataIdentifier
         */
        public void setMatrixDefault(){
                if (getVarParam(RAND_BY_ROW) == null)
-                       addVarParam(RAND_BY_ROW, new BooleanIdentifier(true,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn()));
+                       addVarParam(RAND_BY_ROW, new BooleanIdentifier(true, 
this));
        }
-       
-       public void setRandDefault(){
-               if (getVarParam(RAND_ROWS)== null){
-                       IntIdentifier id = new IntIdentifier(1L,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
-                       addVarParam(RAND_ROWS,  id);
+
+       public void setRandDefault() {
+               if (getVarParam(RAND_ROWS) == null) {
+                       IntIdentifier id = new IntIdentifier(1L, this);
+                       addVarParam(RAND_ROWS, id);
                }
-               if (getVarParam(RAND_COLS)== null){
-                       IntIdentifier id = new IntIdentifier(1L,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
-            addVarParam(RAND_COLS,     id);
+               if (getVarParam(RAND_COLS) == null) {
+                       IntIdentifier id = new IntIdentifier(1L, this);
+                       addVarParam(RAND_COLS, id);
                }
-               if (getVarParam(RAND_MIN)== null){
-                       DoubleIdentifier id = new DoubleIdentifier(0.0,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (getVarParam(RAND_MIN) == null) {
+                       DoubleIdentifier id = new DoubleIdentifier(0.0, this);
                        addVarParam(RAND_MIN, id);
                }
-               if (getVarParam(RAND_MAX)== null){
-                       DoubleIdentifier id = new DoubleIdentifier(1.0,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (getVarParam(RAND_MAX) == null) {
+                       DoubleIdentifier id = new DoubleIdentifier(1.0, this);
                        addVarParam(RAND_MAX, id);
                }
-               if (getVarParam(RAND_SPARSITY)== null){
-                       DoubleIdentifier id = new DoubleIdentifier(1.0,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
-                       addVarParam(RAND_SPARSITY,      id);
+               if (getVarParam(RAND_SPARSITY) == null) {
+                       DoubleIdentifier id = new DoubleIdentifier(1.0, this);
+                       addVarParam(RAND_SPARSITY, id);
                }
-               if (getVarParam(RAND_SEED)== null){
-                       IntIdentifier id = new 
IntIdentifier(DataGenOp.UNSPECIFIED_SEED,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (getVarParam(RAND_SEED) == null) {
+                       IntIdentifier id = new 
IntIdentifier(DataGenOp.UNSPECIFIED_SEED, this);
                        addVarParam(RAND_SEED, id);
                }
-               if (getVarParam(RAND_PDF)== null){
-                       StringIdentifier id = new 
StringIdentifier(RAND_PDF_UNIFORM,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (getVarParam(RAND_PDF) == null) {
+                       StringIdentifier id = new 
StringIdentifier(RAND_PDF_UNIFORM, this);
                        addVarParam(RAND_PDF, id);
                }
-               if (getVarParam(RAND_LAMBDA)== null){
-                       DoubleIdentifier id = new DoubleIdentifier(1.0,
-                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                       this.getBeginLine(), 
this.getBeginColumn());
+               if (getVarParam(RAND_LAMBDA) == null) {
+                       DoubleIdentifier id = new DoubleIdentifier(1.0, this);
                        addVarParam(RAND_LAMBDA, id);
                }
        }
-       
-       
+
        public void setOpCode(DataOp op) {
                _opcode = op;
        }
@@ -496,6 +471,7 @@ public class DataExpression extends DataIdentifier
                if (getBeginColumn() == 0)      
setBeginColumn(value.getBeginColumn());
                if (getEndLine() == 0)          setEndLine(value.getEndLine());
                if (getEndColumn() == 0)        
setEndColumn(value.getEndColumn());
+               if (getText() == null) setText(value.getText());
                
        }
        
@@ -517,15 +493,13 @@ public class DataExpression extends DataIdentifier
                        Expression.BinaryOp op = expr.getOpCode();
                        switch (op){
                        case PLUS:
-                                       filename = "";
-                                       filename = fileNameCat(expr, 
currConstVars, filename, conditional);
-                                       // Since we have computed the value of 
filename, we update
-                                       // varParams with a const string value
-                                       StringIdentifier fileString = new 
StringIdentifier(filename, 
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(), 
-                                                       this.getEndLine(), 
this.getEndColumn());
-                                       removeVarParam(IO_FILENAME);
-                                       addVarParam(IO_FILENAME, fileString);
+                               filename = "";
+                               filename = fileNameCat(expr, currConstVars, 
filename, conditional);
+                               // Since we have computed the value of 
filename, we update
+                               // varParams with a const string value
+                               StringIdentifier fileString = new 
StringIdentifier(filename, this);
+                               removeVarParam(IO_FILENAME);
+                               addVarParam(IO_FILENAME, fileString);
                                break;
                        default:
                                raiseValidateError("for read method, parameter 
" + IO_FILENAME + " can only be const string concatenations. ", conditional);
@@ -634,7 +608,7 @@ public class DataExpression extends DataIdentifier
                        {
                                String fsext = 
InfrastructureAnalyzer.isLocalMode() ? "FS (local mode)" : "HDFS";
                                raiseValidateError("Read input file does not 
exist on "+fsext+": " + 
-                                               inputFileName, conditional, 
LanguageErrorCodes.INVALID_PARAMETERS);                                         
                    
+                                               inputFileName, conditional);
                        }
 
                        // track whether format type has been inferred 
@@ -646,12 +620,9 @@ public class DataExpression extends DataIdentifier
                        // check if file is matrix market format
                        if (formatTypeString == null && shouldReadMTD){
                                boolean isMatrixMarketFormat = 
checkHasMatrixMarketFormat(inputFileName, mtdFileName, conditional); 
-                               if (isMatrixMarketFormat){
-                                       
+                               if (isMatrixMarketFormat) {
                                        formatTypeString = 
FORMAT_TYPE_VALUE_MATRIXMARKET;
-                                       addVarParam(FORMAT_TYPE,new 
StringIdentifier(FORMAT_TYPE_VALUE_MATRIXMARKET,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                                       addVarParam(FORMAT_TYPE, new 
StringIdentifier(FORMAT_TYPE_VALUE_MATRIXMARKET, this));
                                        inferredFormatType = true;
                                        shouldReadMTD = false;
                                }
@@ -661,14 +632,12 @@ public class DataExpression extends DataIdentifier
                        if (formatTypeString == null && shouldReadMTD ) {
                                boolean isDelimitedFormat = 
checkHasDelimitedFormat(inputFileName, conditional); 
                                
-                               if (isDelimitedFormat){
-                                       addVarParam(FORMAT_TYPE,new 
StringIdentifier(FORMAT_TYPE_VALUE_CSV,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                               if (isDelimitedFormat) {
+                                       addVarParam(FORMAT_TYPE, new 
StringIdentifier(FORMAT_TYPE_VALUE_CSV, this));
                                        formatTypeString = 
FORMAT_TYPE_VALUE_CSV;
                                        inferredFormatType = true;
-                                       //shouldReadMTD = false;
-                               }       
+                                       // shouldReadMTD = false;
+                               }
                        }
                        
                                
@@ -724,40 +693,36 @@ public class DataExpression extends DataIdentifier
                                                rowsCount = 
Long.parseLong(sizeInfo[0]);
                                                if (rowsCount < 1)
                                                        throw new 
Exception("invalid rows count");
-                                               addVarParam(READROWPARAM, new 
IntIdentifier(rowsCount,
-                                                               
this.getFilename(), this.getBeginLine(), this.getBeginColumn(),
-                                                               
this.getBeginLine(), this.getBeginColumn()));
-                                       }
-                                       catch(Exception e){
-                                               raiseValidateError("In 
MatrixMarket file " + getVarParam(IO_FILENAME) 
-                                                               +  " invalid 
row count " + sizeInfo[0] + " (must be long value >= 1). Sizing info line from 
file: " + headerLines[1], conditional, LanguageErrorCodes.INVALID_PARAMETERS);
+                                               addVarParam(READROWPARAM, new 
IntIdentifier(rowsCount, this));
+                                       } catch (Exception e) {
+                                               raiseValidateError(
+                                                               "In 
MatrixMarket file " + getVarParam(IO_FILENAME) + " invalid row count " + 
sizeInfo[0]
+                                                                               
+ " (must be long value >= 1). Sizing info line from file: " + headerLines[1],
+                                                               conditional, 
LanguageErrorCodes.INVALID_PARAMETERS);
                                        }
-                               
+
                                        try {
                                                colsCount = 
Long.parseLong(sizeInfo[1]);
                                                if (colsCount < 1)
                                                        throw new 
Exception("invalid cols count");
-                                               addVarParam(READCOLPARAM, new 
IntIdentifier(colsCount,
-                                                               
this.getFilename(), this.getBeginLine(), this.getBeginColumn(),
-                                                               
this.getBeginLine(), this.getBeginColumn()));
+                                               addVarParam(READCOLPARAM, new 
IntIdentifier(colsCount, this));
+                                       } catch (Exception e) {
+                                               raiseValidateError("In 
MatrixMarket file " + getVarParam(IO_FILENAME) + " invalid column count "
+                                                               + sizeInfo[1] + 
" (must be long value >= 1). Sizing info line from file: "
+                                                               + 
headerLines[1], conditional, LanguageErrorCodes.INVALID_PARAMETERS);
                                        }
-                                       catch(Exception e){
-                                               raiseValidateError("In 
MatrixMarket file " + getVarParam(IO_FILENAME) 
-                                                               +  " invalid 
column count " + sizeInfo[1] + " (must be long value >= 1). Sizing info line 
from file: " + headerLines[1], conditional, 
LanguageErrorCodes.INVALID_PARAMETERS);
-                                       }
-                                       
+
                                        try {
                                                nnzCount = 
Long.parseLong(sizeInfo[2]);
                                                if (nnzCount < 1)
                                                        throw new 
Exception("invalid nnz count");
-                                               addVarParam("nnz", new 
IntIdentifier(nnzCount, 
-                                                               
this.getFilename(), this.getBeginLine(), this.getBeginColumn(),
-                                                               
this.getBeginLine(), this.getBeginColumn()));
+                                               addVarParam("nnz", new 
IntIdentifier(nnzCount, this));
+                                       } catch (Exception e) {
+                                               raiseValidateError("In 
MatrixMarket file " + getVarParam(IO_FILENAME)
+                                                               + " invalid 
number non-zeros " + sizeInfo[2]
+                                                               + " (must be 
long value >= 1). Sizing info line from file: " + headerLines[1],
+                                                               conditional, 
LanguageErrorCodes.INVALID_PARAMETERS);
                                        }
-                                       catch(Exception e){
-                                               raiseValidateError("In 
MatrixMarket file " + getVarParam(IO_FILENAME) 
-                                                               +  " invalid 
number non-zeros " + sizeInfo[2] + " (must be long value >= 1). Sizing info 
line from file: " + headerLines[1], conditional, 
LanguageErrorCodes.INVALID_PARAMETERS);
-                                       }       
                                }
                        }
                        
@@ -816,12 +781,9 @@ public class DataExpression extends DataIdentifier
                                }
                                
                                // DEFAULT for "sep" : ","
-                               if (getVarParam(DELIM_DELIMITER) == null){
-                                       addVarParam(DELIM_DELIMITER, new 
StringIdentifier(DEFAULT_DELIM_DELIMITER,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
-                               }
-                               else {
+                               if (getVarParam(DELIM_DELIMITER) == null) {
+                                       addVarParam(DELIM_DELIMITER, new 
StringIdentifier(DEFAULT_DELIM_DELIMITER, this));
+                               } else {
                                        if ( (getVarParam(DELIM_DELIMITER) 
instanceof ConstIdentifier)
                                                && (! 
(getVarParam(DELIM_DELIMITER) instanceof StringIdentifier)))
                                        {
@@ -831,12 +793,9 @@ public class DataExpression extends DataIdentifier
                                } 
                                
                                // DEFAULT for "default": 0
-                               if (getVarParam(DELIM_FILL_VALUE) == null){
-                                       addVarParam(DELIM_FILL_VALUE, new 
DoubleIdentifier(DEFAULT_DELIM_FILL_VALUE,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
-                               }
-                               else {
+                               if (getVarParam(DELIM_FILL_VALUE) == null) {
+                                       addVarParam(DELIM_FILL_VALUE, new 
DoubleIdentifier(DEFAULT_DELIM_FILL_VALUE, this));
+                               } else {
                                        if ( (getVarParam(DELIM_FILL_VALUE) 
instanceof ConstIdentifier)
                                                        && (! 
(getVarParam(DELIM_FILL_VALUE) instanceof IntIdentifier ||  
getVarParam(DELIM_FILL_VALUE) instanceof DoubleIdentifier)))
                                        {
@@ -845,12 +804,9 @@ public class DataExpression extends DataIdentifier
                                } 
                                
                                // DEFAULT for "header": boolean false
-                               if (getVarParam(DELIM_HAS_HEADER_ROW) == null){
-                                       addVarParam(DELIM_HAS_HEADER_ROW, new 
BooleanIdentifier(DEFAULT_DELIM_HAS_HEADER_ROW,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
-                               }
-                               else {
+                               if (getVarParam(DELIM_HAS_HEADER_ROW) == null) {
+                                       addVarParam(DELIM_HAS_HEADER_ROW, new 
BooleanIdentifier(DEFAULT_DELIM_HAS_HEADER_ROW, this));
+                               } else {
                                        if ((getVarParam(DELIM_HAS_HEADER_ROW) 
instanceof ConstIdentifier)
                                                && (! 
(getVarParam(DELIM_HAS_HEADER_ROW) instanceof BooleanIdentifier)))
                                        {
@@ -860,9 +816,7 @@ public class DataExpression extends DataIdentifier
                                
                                // DEFAULT for "fill": boolean false
                                if (getVarParam(DELIM_FILL) == null){
-                                       addVarParam(DELIM_FILL,new 
BooleanIdentifier(DEFAULT_DELIM_FILL,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                                       addVarParam(DELIM_FILL, new 
BooleanIdentifier(DEFAULT_DELIM_FILL, this));
                                }
                                else {
                                        
@@ -1013,20 +967,14 @@ public class DataExpression extends DataIdentifier
                        
                        // for delimited format, if no delimiter specified THEN 
set default ","
                        if (getVarParam(FORMAT_TYPE) == null || 
getVarParam(FORMAT_TYPE).toString().equalsIgnoreCase(FORMAT_TYPE_VALUE_CSV)){
-                               if (getVarParam(DELIM_DELIMITER) == null){
-                                       addVarParam(DELIM_DELIMITER, new 
StringIdentifier(DEFAULT_DELIM_DELIMITER,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                               if (getVarParam(DELIM_DELIMITER) == null) {
+                                       addVarParam(DELIM_DELIMITER, new 
StringIdentifier(DEFAULT_DELIM_DELIMITER, this));
                                }
-                               if (getVarParam(DELIM_HAS_HEADER_ROW) == null){
-                                       addVarParam(DELIM_HAS_HEADER_ROW, new 
BooleanIdentifier(DEFAULT_DELIM_HAS_HEADER_ROW,
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                               if (getVarParam(DELIM_HAS_HEADER_ROW) == null) {
+                                       addVarParam(DELIM_HAS_HEADER_ROW, new 
BooleanIdentifier(DEFAULT_DELIM_HAS_HEADER_ROW, this));
                                }
-                               if (getVarParam(DELIM_SPARSE) == null){
-                                       addVarParam(DELIM_SPARSE, new 
BooleanIdentifier(DEFAULT_DELIM_SPARSE, 
-                                                       this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(),
-                                                       this.getBeginLine(), 
this.getBeginColumn()));
+                               if (getVarParam(DELIM_SPARSE) == null) {
+                                       addVarParam(DELIM_SPARSE, new 
BooleanIdentifier(DEFAULT_DELIM_SPARSE, this));
                                }
                        }
                        
@@ -1085,24 +1033,21 @@ public class DataExpression extends DataIdentifier
                                // handle integer constant 
                                else if (dataParam instanceof IntIdentifier) {
                                        long roundedValue = 
((IntIdentifier)dataParam).getValue();
-                                       Expression minExpr = new 
DoubleIdentifier(roundedValue, getFilename(), 
-                                                       getBeginLine(), 
getBeginColumn(), getEndLine(), getEndColumn());
+                                       Expression minExpr = new 
DoubleIdentifier(roundedValue, this);
                                        addVarParam(RAND_MIN, minExpr);
                                        addVarParam(RAND_MAX, minExpr);
                                }
                                // handle double constant 
                                else if (dataParam instanceof DoubleIdentifier) 
{
                                        double roundedValue = 
((DoubleIdentifier)dataParam).getValue();
-                                       Expression minExpr = new 
DoubleIdentifier(roundedValue, getFilename(), 
-                                                       getBeginLine(), 
getBeginColumn(), getEndLine(), getEndColumn());
+                                       Expression minExpr = new 
DoubleIdentifier(roundedValue, this);
                                        addVarParam(RAND_MIN, minExpr);
-                                       addVarParam(RAND_MAX, minExpr);         
                
+                                       addVarParam(RAND_MAX, minExpr);
                                }
                                // handle string constant (string init) 
                                else if (dataParam instanceof StringIdentifier) 
{
                                        String data = 
((StringIdentifier)dataParam).getValue();
-                                       Expression minExpr = new 
StringIdentifier(data, getFilename(), 
-                                                       getBeginLine(), 
getBeginColumn(), getEndLine(), getEndColumn());
+                                       Expression minExpr = new 
StringIdentifier(data, this);
                                        addVarParam(RAND_MIN, minExpr);
                                        addVarParam(RAND_MAX, minExpr); 
                                        _strInit = true;
@@ -1210,9 +1155,7 @@ public class DataExpression extends DataIdentifier
                                                }
                                                // update row expr with new 
IntIdentifier 
                                                long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                               rowsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               rowsExpr = new 
IntIdentifier(roundedValue, this);
                                                addVarParam(RAND_ROWS, 
rowsExpr);
                                                rowsLong = roundedValue; 
                                        }
@@ -1225,9 +1168,7 @@ public class DataExpression extends DataIdentifier
                                                }
                                                // update row expr with new 
IntIdentifier (rounded down)
                                                long roundedValue = 
Double.valueOf(Math.floor(((DoubleIdentifier)constValue).getValue())).longValue();
-                                               rowsExpr = new 
IntIdentifier(roundedValue, this.getFilename(),
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               rowsExpr = new 
IntIdentifier(roundedValue, this);
                                                addVarParam(RAND_ROWS, 
rowsExpr);
                                                rowsLong = roundedValue; 
                                                
@@ -1289,9 +1230,7 @@ public class DataExpression extends DataIdentifier
                                                }
                                                // update col expr with new 
IntIdentifier 
                                                long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                               colsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               colsExpr = new 
IntIdentifier(roundedValue, this);
                                                addVarParam(RAND_COLS, 
colsExpr);
                                                colsLong = roundedValue; 
                                        }
@@ -1304,9 +1243,7 @@ public class DataExpression extends DataIdentifier
                                                }
                                                // update col expr with new 
IntIdentifier (rounded down)
                                                long roundedValue = 
Double.valueOf(Math.floor(((DoubleIdentifier)constValue).getValue())).longValue();
-                                               colsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               colsExpr = new 
IntIdentifier(roundedValue, this);
                                                addVarParam(RAND_COLS, 
colsExpr);
                                                colsLong = roundedValue; 
                                                
@@ -1346,9 +1283,7 @@ public class DataExpression extends DataIdentifier
                                                
                                                // update min expr with new 
IntIdentifier 
                                                long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                               minExpr = new 
DoubleIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               minExpr = new 
DoubleIdentifier(roundedValue, this);
                                                addVarParam(RAND_MIN, minExpr);
                                        }
                                        // handle double constant 
@@ -1356,9 +1291,7 @@ public class DataExpression extends DataIdentifier
                
                                                // update col expr with new 
IntIdentifier (rounded down)
                                                double roundedValue = 
((DoubleIdentifier)constValue).getValue();
-                                               minExpr = new 
DoubleIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               minExpr = new 
DoubleIdentifier(roundedValue, this);
                                                addVarParam(RAND_MIN, minExpr);
                                                
                                        }
@@ -1398,9 +1331,7 @@ public class DataExpression extends DataIdentifier
                                                
                                                // update min expr with new 
IntIdentifier 
                                                long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                               maxExpr = new 
DoubleIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               maxExpr = new 
DoubleIdentifier(roundedValue, this);
                                                addVarParam(RAND_MAX, maxExpr);
                                        }
                                        // handle double constant 
@@ -1408,9 +1339,7 @@ public class DataExpression extends DataIdentifier
                
                                                // update col expr with new 
IntIdentifier (rounded down)
                                                double roundedValue = 
((DoubleIdentifier)constValue).getValue();
-                                               maxExpr = new 
DoubleIdentifier(roundedValue, this.getFilename(), 
-                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               maxExpr = new 
DoubleIdentifier(roundedValue, this);
                                                addVarParam(RAND_MAX, maxExpr);
                                                
                                        }
@@ -1530,9 +1459,7 @@ public class DataExpression extends DataIdentifier
                                                        }
                                                        // update row expr with 
new IntIdentifier 
                                                        long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                                       rowsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                                       
this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       rowsExpr = new 
IntIdentifier(roundedValue, this);
                                                        addVarParam(RAND_ROWS, 
rowsExpr);
                                                        rowsLong = 
roundedValue; 
                                                }
@@ -1545,9 +1472,7 @@ public class DataExpression extends DataIdentifier
                                                        }
                                                        // update row expr with 
new IntIdentifier (rounded down)
                                                        long roundedValue = 
Double.valueOf(Math.floor(((DoubleIdentifier)constValue).getValue())).longValue();
-                                                       rowsExpr = new 
IntIdentifier(roundedValue,  this.getFilename(), 
-                                                                       
this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       rowsExpr = new 
IntIdentifier(roundedValue, this);
                                                        addVarParam(RAND_ROWS, 
rowsExpr);
                                                        rowsLong = 
roundedValue; 
                                                        
@@ -1611,9 +1536,7 @@ public class DataExpression extends DataIdentifier
                                                        }
                                                        // update col expr with 
new IntIdentifier 
                                                        long roundedValue = 
((IntIdentifier)constValue).getValue();
-                                                       colsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                                       
this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       colsExpr = new 
IntIdentifier(roundedValue, this);
                                                        addVarParam(RAND_COLS, 
colsExpr);
                                                        colsLong = 
roundedValue; 
                                                }
@@ -1627,9 +1550,7 @@ public class DataExpression extends DataIdentifier
                                                        }
                                                        // update col expr with 
new IntIdentifier (rounded down)
                                                        long roundedValue = 
Double.valueOf(Math.floor(((DoubleIdentifier)constValue).getValue())).longValue();
-                                                       colsExpr = new 
IntIdentifier(roundedValue, this.getFilename(), 
-                                                                       
this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       colsExpr = new 
IntIdentifier(roundedValue, this);
                                                        addVarParam(RAND_COLS, 
colsExpr);
                                                        colsLong = 
roundedValue; 
                                                        
@@ -1813,23 +1734,21 @@ public class DataExpression extends DataIdentifier
                        }
                        
                        // if the read method parameter is a constant, then 
verify value matches MTD metadata file
-                       if (getVarParam(key.toString()) != null && 
(getVarParam(key.toString()) instanceof ConstIdentifier) 
-                                       && 
!getVarParam(key.toString()).toString().equalsIgnoreCase(val.toString()) )
-                       {
-                               raiseValidateError("parameter " + 
key.toString() + " has conflicting values in read statement definition and 
metadata. " +
-                                               "Config file value: " + 
val.toString() + " from MTD file.  Read statement value: " + 
getVarParam(key.toString()), conditional);
-                       }
-                       else 
-                       {
+                       if (getVarParam(key.toString()) != null && 
(getVarParam(key.toString()) instanceof ConstIdentifier)
+                                       && 
!getVarParam(key.toString()).toString().equalsIgnoreCase(val.toString())) {
+                               raiseValidateError(
+                                               "Parameter '" + key.toString()
+                                                               + "' has 
conflicting values in metadata and read statement. MTD file value: '"
+                                                               + 
val.toString() + "'. Read statement value: '" + getVarParam(key.toString()) + 
"'.",
+                                               conditional);
+                       } else {
                                // if the read method does not specify 
parameter value, then add MTD metadata file value to parameter list
                                if (getVarParam(key.toString()) == null){
                                        if (( 
!key.toString().equalsIgnoreCase(DESCRIPTIONPARAM) ) &&
                                                        ( 
!key.toString().equalsIgnoreCase(AUTHORPARAM) ) &&
                                                        ( 
!key.toString().equalsIgnoreCase(CREATEDPARAM) ) )
                                        {
-                                               StringIdentifier strId = new 
StringIdentifier(val.toString(),
-                                                               
this.getFilename(), this.getBeginLine(), this.getBeginColumn(), 
-                                                               
this.getEndLine(), this.getEndColumn());
+                                               StringIdentifier strId = new 
StringIdentifier(val.toString(), this);
                                                
                                                if ( 
key.toString().equalsIgnoreCase(DELIM_HAS_HEADER_ROW) 
                                                                || 
key.toString().equalsIgnoreCase(DELIM_FILL)
@@ -1837,17 +1756,11 @@ public class DataExpression extends DataIdentifier
                                                                ) {
                                                        // parse these 
parameters as boolean values
                                                        BooleanIdentifier 
boolId = null; 
-                                                       if ( 
strId.toString().equalsIgnoreCase("true") ) {
-                                                               boolId = new 
BooleanIdentifier(true, this.getFilename(), 
-                                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                                               
this.getEndLine(), this.getEndColumn());
-                                                       }
-                                                       else if ( 
strId.toString().equalsIgnoreCase("false") ) {
-                                                               boolId = new 
BooleanIdentifier(false, this.getFilename(), 
-                                                                               
this.getBeginLine(), this.getBeginColumn(), 
-                                                                               
this.getEndLine(), this.getEndColumn());
-                                                       }
-                                                       else {
+                                                       if 
(strId.toString().equalsIgnoreCase("true")) {
+                                                               boolId = new 
BooleanIdentifier(true, this);
+                                                       } else if 
(strId.toString().equalsIgnoreCase("false")) {
+                                                               boolId = new 
BooleanIdentifier(false, this);
+                                                       } else {
                                                                
raiseValidateError("Invalid value provided for '" + DELIM_HAS_HEADER_ROW + "' 
in metadata file '" + mtdFileName + "'. "
                                                                                
+ "Must be either TRUE or FALSE.", conditional);
                                                        }
@@ -1856,9 +1769,8 @@ public class DataExpression extends DataIdentifier
                                                }
                                                else if ( 
key.toString().equalsIgnoreCase(DELIM_FILL_VALUE)) {
                                                        // parse these 
parameters as numeric values
-                                                       DoubleIdentifier 
doubleId = new DoubleIdentifier( Double.parseDouble(strId.toString()),
-                                                                       
this.getFilename(), this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       DoubleIdentifier 
doubleId = new DoubleIdentifier(Double.parseDouble(strId.toString()),
+                                                                       this);
                                                        
removeVarParam(key.toString());
                                                        
addVarParam(key.toString(), doubleId);
                                                }
@@ -1877,9 +1789,7 @@ public class DataExpression extends DataIdentifier
                                                                }
                                                                naStrings = 
sb.toString();
                                                        }
-                                                       StringIdentifier sid = 
new StringIdentifier( naStrings,
-                                                                       
this.getFilename(), this.getBeginLine(), this.getBeginColumn(), 
-                                                                       
this.getEndLine(), this.getEndColumn());
+                                                       StringIdentifier sid = 
new StringIdentifier(naStrings, this);
                                                        
removeVarParam(key.toString());
                                                        
addVarParam(key.toString(), sid);
                                                }

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DataIdentifier.java 
b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
index 1cd00d1..5523cec 100644
--- a/src/main/java/org/apache/sysml/parser/DataIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/DataIdentifier.java
@@ -31,11 +31,7 @@ public class DataIdentifier extends Identifier
                _valueTypeString = passed.getValueType().toString();    
                
                // set location information
-               setFilename(passed.getFilename());
-               setBeginLine(passed.getBeginLine());
-               setBeginColumn(passed.getBeginColumn());
-               setEndLine(passed.getEndLine());
-               setEndColumn(passed.getEndColumn());
+               setParseInfo(passed);
        }
        
        public Expression rewriteExpression(String prefix) throws 
LanguageException{

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java 
b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
index febdbb4..b6c60fb 100644
--- a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java
@@ -19,6 +19,7 @@
 
 package org.apache.sysml.parser;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.sysml.runtime.util.UtilFunctions;
 
 
@@ -27,26 +28,39 @@ public class DoubleIdentifier extends ConstIdentifier
 {
        
        private double _val;
-       
-       
-       public DoubleIdentifier(double val, String filename, int blp, int bcp, 
int elp, int ecp){
+
+       public DoubleIdentifier(double val) {
                super();
-                _val = val;
-               setDimensions(0,0);
-        computeDataType();
-        setValueType(ValueType.DOUBLE);
-        setAllPositions(filename, blp, bcp, elp, ecp);
+               setInfo(val);
+               setBeginLine(-1);
+               setBeginColumn(-1);
+               setEndLine(-1);
+               setEndColumn(-1);
+               setText(null);
        }
-       
-       public DoubleIdentifier(DoubleIdentifier d, String filename, int blp, 
int bcp, int elp, int ecp){
-               super();
-                _val = d.getValue();
-               setDimensions(0,0);
-        computeDataType();
-        setValueType(ValueType.DOUBLE);
-        setAllPositions(filename, blp, bcp, elp, ecp);
+
+       public DoubleIdentifier(double val, ParseInfo parseInfo) {
+               this(val);
+               setParseInfo(parseInfo);
        }
-       
+
+       public DoubleIdentifier(DoubleIdentifier d, ParseInfo parseInfo) {
+               this(d.getValue());
+               setParseInfo(parseInfo);
+       }
+
+       public DoubleIdentifier(ParserRuleContext ctx, double val, String 
filename) {
+               this(val);
+               setCtxValuesAndFilename(ctx, filename);
+       }
+
+       private void setInfo(double val) {
+               _val = val;
+               setDimensions(0, 0);
+               computeDataType();
+               setValueType(ValueType.DOUBLE);
+       }
+
        public Expression rewriteExpression(String prefix) throws 
LanguageException{
                return this;
        }

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/Expression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/Expression.java 
b/src/main/java/org/apache/sysml/parser/Expression.java
index e61a932..a68f59f 100644
--- a/src/main/java/org/apache/sysml/parser/Expression.java
+++ b/src/main/java/org/apache/sysml/parser/Expression.java
@@ -22,6 +22,8 @@ package org.apache.sysml.parser;
 import java.util.ArrayList;
 import java.util.HashMap;
 
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.misc.Interval;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -29,7 +31,7 @@ import org.apache.sysml.hops.Hop.FileFormatTypes;
 import org.apache.sysml.runtime.controlprogram.parfor.util.IDSequence;
 
 
-public abstract class Expression 
+public abstract class Expression implements ParseInfo
 {
        /**
         * Binary operators.
@@ -518,28 +520,19 @@ public abstract class Expression
         * @param errorCode optional error code
         * @throws LanguageException thrown if conditional is {@code false}.
         */
-       public void raiseValidateError( String message, boolean conditional, 
String errorCode ) 
-               throws LanguageException
-       {
-               if( conditional )  //warning if conditional
-               {
-                       String fullMsg = this.printWarningLocation() + message;
-                       
-                       LOG.warn( fullMsg );
-               }
-               else  //error and exception if unconditional
-               {
-                       String fullMsg = this.printErrorLocation() + message;
-                       
-                       //LOG.error( fullMsg ); //no redundant error            
        
-                       if( errorCode != null )
-                               throw new LanguageException( fullMsg, errorCode 
);
-                       else 
-                               throw new LanguageException( fullMsg );
+       public void raiseValidateError(String msg, boolean conditional, String 
errorCode) throws LanguageException {
+               if (conditional) {// warning if conditional
+                       String fullMsg = this.printWarningLocation() + msg;
+                       LOG.warn(fullMsg);
+               } else {// error and exception if unconditional
+                       String fullMsg = this.printErrorLocation() + msg;
+                       if (errorCode != null)
+                               throw new LanguageException(fullMsg, errorCode);
+                       else
+                               throw new LanguageException(fullMsg);
                }
        }
-       
-       
+
        /**
         * Returns the matrix characteristics for scalar-scalar, scalar-matrix, 
matrix-scalar, matrix-matrix
         * operations. This method is aware of potentially unknowns and 
matrix-vector (col/row) operations.
@@ -597,6 +590,7 @@ public abstract class Expression
        private String _filename;
        private int _beginLine, _beginColumn;
        private int _endLine, _endColumn;
+       private String _text;
        private ArrayList<String> _parseExceptionList = new ArrayList<String>();
        
        public void setFilename(String passed)  { _filename = passed;   }
@@ -604,50 +598,110 @@ public abstract class Expression
        public void setBeginColumn(int passed)  { _beginColumn = passed; }
        public void setEndLine(int passed)              { _endLine = passed;   }
        public void setEndColumn(int passed)    { _endColumn = passed; }
+       public void setText(String text) { _text = text; }
        public void setParseExceptionList(ArrayList<String> passed) { 
_parseExceptionList = passed;}
-       
+
        /**
-        * Set the filename, the beginning line/column positions, and the 
ending line/column positions.
-        * 
-        * @param filename The DML/PYDML filename (if it exists)
-        * @param blp Beginning line position
-        * @param bcp Beginning column position
-        * @param elp Ending line position
-        * @param ecp Ending column position
+        * Set parse information.
+        *
+        * @param parseInfo
+        *            parse information, such as beginning line position, 
beginning
+        *            column position, ending line position, ending column 
position,
+        *            text, and filename
+        * @param filename
+        *            the DML/PYDML filename (if it exists)
+        */
+       public void setParseInfo(ParseInfo parseInfo) {
+               _beginLine = parseInfo.getBeginLine();
+               _beginColumn = parseInfo.getBeginColumn();
+               _endLine = parseInfo.getEndLine();
+               _endColumn = parseInfo.getEndColumn();
+               _text = parseInfo.getText();
+               _filename = parseInfo.getFilename();
+       }
+
+       /**
+        * Set ParserRuleContext values (begin line, begin column, end line, end
+        * column, and text).
+        *
+        * @param ctx
+        *            the antlr ParserRuleContext
+        */
+       public void setCtxValues(ParserRuleContext ctx) {
+               setBeginLine(ctx.start.getLine());
+               setBeginColumn(ctx.start.getCharPositionInLine());
+               setEndLine(ctx.stop.getLine());
+               setEndColumn(ctx.stop.getCharPositionInLine());
+               // preserve whitespace if possible
+               if ((ctx.start != null) && (ctx.stop != null) && 
(ctx.start.getStartIndex() != -1)
+                               && (ctx.stop.getStopIndex() != -1) && 
(ctx.start.getStartIndex() <= ctx.stop.getStopIndex())
+                               && (ctx.start.getInputStream() != null)) {
+                       String text = ctx.start.getInputStream()
+                                       
.getText(Interval.of(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
+                       if (text != null) {
+                               text = text.trim();
+                       }
+                       setText(text);
+               } else {
+                       String text = ctx.getText();
+                       if (text != null) {
+                               text = text.trim();
+                       }
+                       setText(text);
+               }
+       }
+
+       /**
+        * Set ParserRuleContext values (begin line, begin column, end line, end
+        * column, and text) and file name.
+        *
+        * @param ctx
+        *            the antlr ParserRuleContext
+        * @param filename
+        *            the filename (if it exists)
         */
-       public void setAllPositions(String filename, int blp, int bcp, int elp, 
int ecp){
-               _filename    = filename;
-               _beginLine       = blp; 
-               _beginColumn = bcp; 
-               _endLine         = elp;
-               _endColumn       = ecp;
+       public void setCtxValuesAndFilename(ParserRuleContext ctx, String 
filename) {
+               setCtxValues(ctx);
+               setFilename(filename);
        }
 
+
        public String getFilename()     { return _filename;   }
        public int getBeginLine()       { return _beginLine;   }
        public int getBeginColumn() { return _beginColumn; }
        public int getEndLine()         { return _endLine;   }
        public int getEndColumn()       { return _endColumn; }
+       public String getText() { return _text; }
        public ArrayList<String> getParseExceptionList() { return 
_parseExceptionList; }
-       
-       /**
-        * Return error message containing the filename, the beginning line 
position, and the beginning column position.
-        * 
-        * @return the error message
-        */
-       public String printErrorLocation(){
-               return "ERROR: " + _filename + " -- line " + _beginLine + ", 
column " + _beginColumn + " -- ";
+
+       public String printErrorLocation() {
+               String file = _filename;
+               if (file == null) {
+                       file = "";
+               } else {
+                       file = file + " ";
+               }
+               if (getText() != null) {
+                       return "ERROR: " + file + "[line " + _beginLine + ":" + 
_beginColumn + "] -> " + getText() + " -- ";
+               } else {
+                       return "ERROR: " + file + "[line " + _beginLine + ":" + 
_beginColumn + "] -- ";
+               }
        }
-       
-       /**
-        * Return warning message containing the filename, the beginning line 
position, and the beginning column position.
-        * 
-        * @return the warning message
-        */
-       public String printWarningLocation(){
-               return "WARNING: " + _filename + " -- line " + _beginLine + ", 
column " + _beginColumn + " -- ";
+
+       public String printWarningLocation() {
+               String file = _filename;
+               if (file == null) {
+                       file = "";
+               } else {
+                       file = file + " ";
+               }
+               if (getText() != null) {
+                       return "WARNING: " + file + "[line " + _beginLine + ":" 
+ _beginColumn + "] -> " + getText() + " -- ";
+               } else {
+                       return "WARNING: " + file + "[line " + _beginLine + ":" 
+ _beginColumn + "] -- ";
+               }
        }
-       
+
        /**
         * Return info message containing the filename, the beginning line 
position, and the beginning column position.
         * 

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java 
b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
index 782b682..29358db 100644
--- a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java
@@ -376,31 +376,24 @@ public class ForStatementBlock extends StatementBlock
                if (expr instanceof DataIdentifier && !(expr instanceof 
IndexedIdentifier)) 
                {       
                        // check if the DataIdentifier variable is a 
ConstIdentifier
-                       String identifierName = 
((DataIdentifier)expr).getName();
-                       if (currConstVars.containsKey(identifierName))
-                       {
+                       String identifierName = ((DataIdentifier) 
expr).getName();
+                       if (currConstVars.containsKey(identifierName)) {
                                ConstIdentifier constValue = 
currConstVars.get(identifierName);
-                               //AUTO CASTING (using runtime operations for 
consistency)
-                               switch( constValue.getValueType() ) 
-                               {
-                                       case DOUBLE: 
-                                               ret = new IntIdentifier(new 
DoubleObject(((DoubleIdentifier)constValue).getValue()).getLongValue(),
-                                                               
expr.getFilename(), expr.getBeginLine(), expr.getBeginColumn(), 
-                                                               
expr.getEndLine(), expr.getEndColumn());
-                                               break;
-                                       case INT:    
-                                               ret = new 
IntIdentifier((IntIdentifier)constValue,
-                                                               
expr.getFilename(), expr.getBeginLine(), expr.getBeginColumn(), 
-                                                               
expr.getEndLine(), expr.getEndColumn());
-                                               break;
-                                       case BOOLEAN: 
-                                               ret = new IntIdentifier(new 
BooleanObject(((BooleanIdentifier)constValue).getValue()).getLongValue(),
-                                                               
expr.getFilename(), expr.getBeginLine(), expr.getBeginColumn(), 
-                                                               
expr.getEndLine(), expr.getEndColumn());
-                                               break;
-                                               
-                                       default:
-                                               //do nothing
+                               // AUTO CASTING (using runtime operations for 
consistency)
+                               switch (constValue.getValueType()) {
+                               case DOUBLE:
+                                       ret = new IntIdentifier(new 
DoubleObject(((DoubleIdentifier) constValue).getValue()).getLongValue(),
+                                                       expr);
+                                       break;
+                               case INT:
+                                       ret = new IntIdentifier((IntIdentifier) 
constValue, expr);
+                                       break;
+                               case BOOLEAN:
+                                       ret = new IntIdentifier(
+                                                       new 
BooleanObject(((BooleanIdentifier) constValue).getValue()).getLongValue(), 
expr);
+                                       break;
+                               default:
+                                       // do nothing
                                }
                        }
                }

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java 
b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
index f720840..5993091 100644
--- a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java
@@ -60,11 +60,7 @@ public class FunctionCallIdentifier extends DataIdentifier
                
                // rewrite each output expression
                FunctionCallIdentifier fci = new 
FunctionCallIdentifier(newParameterExpressions);
-               
-               fci.setBeginLine(this.getBeginLine());
-               fci.setBeginColumn(this.getBeginColumn());
-               fci.setEndLine(this.getEndLine());
-               fci.setEndColumn(this.getEndColumn());
+               fci.setParseInfo(this);
                        
                fci._name = this._name;
                fci._namespace = this._namespace;

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java 
b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
index cd2bea7..833ecfa 100644
--- a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
+++ b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java
@@ -110,9 +110,8 @@ public class FunctionStatementBlock extends StatementBlock
                                                        if (curr.getValueType() 
== ValueType.INT){
                                                                IntIdentifier 
currIntValue = (IntIdentifier)constVars.get(curr.getName());
                                                                if 
(currIntValue != null){
-                                                                       
DoubleIdentifier currDoubleValue = new 
DoubleIdentifier(currIntValue.getValue(), 
-                                                                               
        curr.getFilename(), curr.getBeginLine(), curr.getBeginColumn(), 
-                                                                               
        curr.getEndLine(), curr.getEndColumn());
+                                                                       
DoubleIdentifier currDoubleValue = new DoubleIdentifier(currIntValue.getValue(),
+                                                                               
        curr);
                                                                        
constVars.put(curr.getName(), currDoubleValue);
                                                                }
                                                                
LOG.warn(curr.printWarningLocation() + "for function " + fstmt.getName() 

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java 
b/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
index 0fda2f9..cb870af 100644
--- a/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/IndexedIdentifier.java
@@ -146,16 +146,10 @@ public class IndexedIdentifier extends DataIdentifier
                                        }       
                                        
                                        if (validRowLB) {
-                                               if (constValue instanceof 
IntIdentifier){
-                                                       _rowLowerBound = new 
IntIdentifier((IntIdentifier)constValue,
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
constValue.getBeginColumn(), 
-                                                                       
constValue.getEndLine(), constValue.getEndColumn());
-                                                       
-                                               }
-                                               else{
-                                                       _rowLowerBound = new 
DoubleIdentifier((DoubleIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
constValue.getBeginColumn(), 
-                                                                       
constValue.getEndLine(), constValue.getEndColumn());
+                                               if (constValue instanceof 
IntIdentifier) {
+                                                       _rowLowerBound = new 
IntIdentifier((IntIdentifier) constValue, constValue);
+                                               } else {
+                                                       _rowLowerBound = new 
DoubleIdentifier((DoubleIdentifier) constValue, constValue);
                                                }
                                                isConst_rowLowerBound = true;
                                        }
@@ -237,19 +231,12 @@ public class IndexedIdentifier extends DataIdentifier
                                                                + rowLB_1 + " 
May cause runtime exception");
                                                validRowUB = false;
                                        }
-                                       
+
                                        if (validRowUB) {
-                                               if (constValue instanceof 
IntIdentifier){
-                                                       _rowUpperBound = new 
IntIdentifier((IntIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
-                                               }
-                                               else{
-                                                       _rowUpperBound = new 
DoubleIdentifier((DoubleIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
+                                               if (constValue instanceof 
IntIdentifier) {
+                                                       _rowUpperBound = new 
IntIdentifier((IntIdentifier) constValue, constValue);
+                                               } else {
+                                                       _rowUpperBound = new 
DoubleIdentifier((DoubleIdentifier) constValue, constValue);
                                                }
                                                isConst_rowUpperBound = true;
                                        }
@@ -316,19 +303,12 @@ public class IndexedIdentifier extends DataIdentifier
                                                                + ": " + 
this.getOrigDim2() +")");
                                                validColLB = false;
                                        }       
-                                       
+
                                        if (validColLB) {
-                                               if (constValue instanceof 
IntIdentifier){
-                                                       _colLowerBound = new 
IntIdentifier((IntIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
-                                               }
-                                               else{
-                                                       _colLowerBound = new 
DoubleIdentifier((DoubleIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
+                                               if (constValue instanceof 
IntIdentifier) {
+                                                       _colLowerBound = new 
IntIdentifier((IntIdentifier) constValue, constValue);
+                                               } else {
+                                                       _colLowerBound = new 
DoubleIdentifier((DoubleIdentifier) constValue, constValue);
                                                }
                                                isConst_colLowerBound = true;
                                        }
@@ -420,19 +400,12 @@ public class IndexedIdentifier extends DataIdentifier
                                        + " May cause runtime exception");
                                                validColUB = false;
                                        }
-                                       
+
                                        if (validColUB) {
-                                               if (constValue instanceof 
IntIdentifier){
-                                                       _colUpperBound = new 
IntIdentifier((IntIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
-                                               }
-                                               else{
-                                                       _colUpperBound = new 
DoubleIdentifier((DoubleIdentifier)constValue, 
-                                                                       
constValue.getFilename(), constValue.getBeginLine(), 
-                                                                       
constValue.getBeginColumn(), constValue.getEndLine(), 
-                                                                       
constValue.getEndColumn());
+                                               if (constValue instanceof 
IntIdentifier) {
+                                                       _colUpperBound = new 
IntIdentifier((IntIdentifier) constValue, constValue);
+                                               } else {
+                                                       _colUpperBound = new 
DoubleIdentifier((DoubleIdentifier) constValue, constValue);
                                                }
                                                isConst_colUpperBound = true;
                                        }
@@ -557,12 +530,7 @@ public class IndexedIdentifier extends DataIdentifier
        public Expression rewriteExpression(String prefix) throws 
LanguageException {
                
                IndexedIdentifier newIndexedIdentifier = new 
IndexedIdentifier(this.getName(), this._rowLowerEqualsUpper, 
this._colLowerEqualsUpper);
-               
-               newIndexedIdentifier.setFilename(getFilename());
-               newIndexedIdentifier.setBeginLine(this.getBeginLine());
-               newIndexedIdentifier.setBeginColumn(this.getBeginColumn());
-               newIndexedIdentifier.setEndLine(this.getEndLine());
-               newIndexedIdentifier.setEndColumn(this.getEndColumn());
+               newIndexedIdentifier.setParseInfo(this);
                        
                // set dimensionality information and other Identifier specific 
properties for new IndexedIdentifier
                newIndexedIdentifier.setProperties(this);

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/IntIdentifier.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IntIdentifier.java 
b/src/main/java/org/apache/sysml/parser/IntIdentifier.java
index 60463e6..d07fbef 100644
--- a/src/main/java/org/apache/sysml/parser/IntIdentifier.java
+++ b/src/main/java/org/apache/sysml/parser/IntIdentifier.java
@@ -19,7 +19,7 @@
 
 package org.apache.sysml.parser;
 
-
+import org.antlr.v4.runtime.ParserRuleContext;
 
 public class IntIdentifier extends ConstIdentifier 
 {
@@ -29,25 +29,39 @@ public class IntIdentifier extends ConstIdentifier
        public Expression rewriteExpression(String prefix) throws 
LanguageException{
                return this;
        }
-       
-       public IntIdentifier(long val, String filename, int blp, int bcp, int 
elp, int ecp){
+
+       public IntIdentifier(long val) {
                super();
-                _val = val;
-               setDimensions(0,0);
-        computeDataType();
-        setValueType(ValueType.INT);
-        setAllPositions(filename, blp, bcp, elp, ecp);
+               setInfo(val);
+               setBeginLine(-1);
+               setBeginColumn(-1);
+               setEndLine(-1);
+               setEndColumn(-1);
+               setText(null);
        }
-       
-       public IntIdentifier(IntIdentifier i, String filename, int blp, int 
bcp, int elp, int ecp){
-               super();
-                _val = i.getValue();
-               setDimensions(0,0);
-        computeDataType();
-        setValueType(ValueType.INT);
-        setAllPositions(filename, blp, bcp, elp, ecp);
+
+       public IntIdentifier(long val, ParseInfo parseInfo) {
+               this(val);
+               setParseInfo(parseInfo);
        }
-       
+
+       public IntIdentifier(IntIdentifier i, ParseInfo parseInfo) {
+               this(i.getValue());
+               setParseInfo(parseInfo);
+       }
+
+       public IntIdentifier(ParserRuleContext ctx, long val, String filename) {
+               this(val);
+               setCtxValuesAndFilename(ctx, filename);
+       }
+
+       private void setInfo(long val) {
+               _val = val;
+               setDimensions(0, 0);
+               computeDataType();
+               setValueType(ValueType.INT);
+       }
+
        // Used only by the parser for unary operation
        public void multiplyByMinusOne() {
                _val = -1 * _val;

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/IterablePredicate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/IterablePredicate.java 
b/src/main/java/org/apache/sysml/parser/IterablePredicate.java
index 86562fb..19fcc4a 100644
--- a/src/main/java/org/apache/sysml/parser/IterablePredicate.java
+++ b/src/main/java/org/apache/sysml/parser/IterablePredicate.java
@@ -21,6 +21,7 @@ package org.apache.sysml.parser;
 
 import java.util.HashMap;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.sysml.lops.Lop;
 
 
@@ -33,20 +34,17 @@ public class IterablePredicate extends Expression
        private Expression _incrementExpr;
        private HashMap<String,String> _parforParams;
        
-       
-       public IterablePredicate(DataIdentifier iterVar, Expression fromExpr, 
Expression toExpr, 
-                       Expression incrementExpr, HashMap<String,String> 
parForParamValues,
-                       String filename, int blp, int bcp, int elp, int ecp)
-       {
+       public IterablePredicate(ParserRuleContext ctx, DataIdentifier iterVar, 
Expression fromExpr, Expression toExpr,
+                       Expression incrementExpr, HashMap<String, String> 
parForParamValues, String filename) {
                _iterVar = iterVar;
                _fromExpr = fromExpr;
                _toExpr = toExpr;
                _incrementExpr = incrementExpr;
-               
+
                _parforParams = parForParamValues;
-               this.setAllPositions(filename, blp, bcp, elp, ecp);
+               this.setCtxValuesAndFilename(ctx, filename);
        }
-               
+
        public String toString()
        { 
                StringBuilder sb = new StringBuilder();
@@ -133,14 +131,12 @@ public class IterablePredicate extends Expression
                
                //2) VALIDATE FOR PREDICATE in (from, to, increment)            
                // handle default increment if unspecified
-               if( _incrementExpr == null && _fromExpr instanceof 
ConstIdentifier 
-                       && _toExpr instanceof ConstIdentifier ) {
+               if (_incrementExpr == null && _fromExpr instanceof 
ConstIdentifier && _toExpr instanceof ConstIdentifier) {
                        ConstIdentifier cFrom = (ConstIdentifier) _fromExpr;
                        ConstIdentifier cTo = (ConstIdentifier) _toExpr;
-                       _incrementExpr = new IntIdentifier( 
(cFrom.getLongValue() <= cTo.getLongValue()) ? 1 : -1, 
-                                       getFilename(), getBeginLine(), 
getBeginColumn(), getEndLine(), getEndColumn());
+                       _incrementExpr = new 
IntIdentifier((cFrom.getLongValue() <= cTo.getLongValue()) ? 1 : -1, this);
                }
-               
+
                //recursively validate the individual expression
                _fromExpr.validateExpression(ids, constVars, conditional);
                _toExpr.validateExpression(ids, constVars, conditional);

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java 
b/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
index c8446f9..1174e27 100644
--- a/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
+++ b/src/main/java/org/apache/sysml/parser/MultiAssignmentStatement.java
@@ -48,10 +48,7 @@ public class MultiAssignmentStatement extends Statement
                
                // create rewritten assignment statement (deep copy)
                MultiAssignmentStatement retVal = new 
MultiAssignmentStatement(newTargetList, newSource);
-               retVal.setBeginLine(this.getBeginLine());
-               retVal.setBeginColumn(this.getBeginColumn());
-               retVal.setEndLine(this.getEndLine());
-               retVal.setEndColumn(this.getEndColumn());
+               retVal.setParseInfo(this);
                
                return retVal;
        }

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/OutputStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/OutputStatement.java 
b/src/main/java/org/apache/sysml/parser/OutputStatement.java
index 00859be..a93f508 100644
--- a/src/main/java/org/apache/sysml/parser/OutputStatement.java
+++ b/src/main/java/org/apache/sysml/parser/OutputStatement.java
@@ -21,6 +21,7 @@ package org.apache.sysml.parser;
 
 import java.util.HashMap;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.sysml.api.DMLScript;
 import org.apache.sysml.debug.DMLBreakpointManager;
 import org.apache.sysml.parser.Expression.DataOp;
@@ -49,12 +50,15 @@ public class OutputStatement extends Statement
        public void setIdentifier(DataIdentifier t) {
                _id = t;
        }
-       
-       public OutputStatement(DataIdentifier t, DataOp op, 
-                       String filename, int blp, int bcp, int elp, int ecp){
+
+       public OutputStatement(ParserRuleContext ctx, DataIdentifier t, DataOp 
op, String filename) {
+               _id = t;
+               _paramsExpr = new DataExpression(ctx, op, new HashMap<String, 
Expression>(), filename);
+       }
+
+       public OutputStatement(DataIdentifier t, DataOp op, ParseInfo 
parseInfo) {
                _id = t;
-               _paramsExpr = new DataExpression(op, new 
HashMap<String,Expression>(),
-                               filename, blp, bcp, elp, ecp);
+               _paramsExpr = new DataExpression(op, new HashMap<String, 
Expression>(), parseInfo);
        }
 
        public static boolean isValidParamName(String key){
@@ -78,10 +82,9 @@ public class OutputStatement extends Statement
        
        // rewrites statement to support function inlining (create deep copy)
        public Statement rewriteStatement(String prefix) throws 
LanguageException{
-               
-               OutputStatement newStatement = new 
OutputStatement(null,Expression.DataOp.WRITE,
-                               this.getFilename(), this.getBeginLine(), 
this.getBeginColumn(), this.getEndLine(), this.getEndColumn());
-               
+
+               OutputStatement newStatement = new OutputStatement(null, 
Expression.DataOp.WRITE, this);
+
                // rewrite outputStatement variable name (creates deep copy)
                newStatement._id = 
(DataIdentifier)this._id.rewriteExpression(prefix);
                
@@ -92,8 +95,7 @@ public class OutputStatement extends Statement
                        Expression newExpr = 
_paramsExpr.getVarParam(key).rewriteExpression(prefix);
                        newExprParams.put(key, newExpr);
                }
-               DataExpression newParamerizedExpr = new DataExpression(op, 
newExprParams,
-                               this.getFilename(), this.getBeginLine(), 
this.getBeginColumn(), this.getEndLine(), this.getEndColumn());
+               DataExpression newParamerizedExpr = new DataExpression(op, 
newExprParams, this);
                newStatement.setExprParams(newParamerizedExpr);
                return newStatement;
        }

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
 
b/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
index 2768cc1..1e28aed 100644
--- 
a/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
+++ 
b/src/main/java/org/apache/sysml/parser/ParameterizedBuiltinFunctionExpression.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.sysml.hops.Hop.ParamBuiltinOp;
 import org.apache.sysml.parser.LanguageException.LanguageErrorCodes;
 import org.apache.wink.json4j.JSONObject;
@@ -104,8 +105,8 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                
pbHopMap.put(Expression.ParameterizedBuiltinFunctionOp.TOSTRING, 
ParamBuiltinOp.TOSTRING);
        }
        
-       public static ParameterizedBuiltinFunctionExpression 
getParamBuiltinFunctionExpression(String functionName, 
-                       ArrayList<ParameterExpression> paramExprsPassed, String 
fileName, int blp, int bcp, int elp, int ecp){
+       public static ParameterizedBuiltinFunctionExpression 
getParamBuiltinFunctionExpression(ParserRuleContext ctx,
+                       String functionName, ArrayList<ParameterExpression> 
paramExprsPassed, String fileName) {
                if (functionName == null || paramExprsPassed == null)
                        return null;
                
@@ -118,17 +119,24 @@ public class ParameterizedBuiltinFunctionExpression 
extends DataIdentifier
                for (ParameterExpression pexpr : paramExprsPassed)
                        varParams.put(pexpr.getName(), pexpr.getExpr());
                
-               ParameterizedBuiltinFunctionExpression retVal = new 
ParameterizedBuiltinFunctionExpression(pbifop,varParams,
-                               fileName, blp, bcp, elp, ecp);
+               ParameterizedBuiltinFunctionExpression retVal = new 
ParameterizedBuiltinFunctionExpression(ctx, pbifop,
+                               varParams, fileName);
                return retVal;
        }
        
                        
-       public 
ParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionOp op, 
HashMap<String,Expression> varParams,
-                       String filename, int blp, int bcp, int elp, int ecp) {
+       public ParameterizedBuiltinFunctionExpression(ParserRuleContext ctx, 
ParameterizedBuiltinFunctionOp op, HashMap<String,Expression> varParams,
+                       String filename) {
                _opcode = op;
                _varParams = varParams;
-               setAllPositions(filename, blp, bcp, elp, ecp);
+               setCtxValuesAndFilename(ctx, filename);
+       }
+
+       public 
ParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionOp op,
+                       HashMap<String, Expression> varParams, ParseInfo 
parseInfo) {
+               _opcode = op;
+               _varParams = varParams;
+               setParseInfo(parseInfo);
        }
 
        public Expression rewriteExpression(String prefix) throws 
LanguageException {
@@ -138,9 +146,9 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                        Expression newExpr = 
_varParams.get(key).rewriteExpression(prefix);
                        newVarParams.put(key, newExpr);
                }       
-               ParameterizedBuiltinFunctionExpression retVal = new 
ParameterizedBuiltinFunctionExpression(_opcode, newVarParams,
-                               this.getFilename(), this.getBeginLine(), 
this.getBeginColumn(), this.getEndLine(), this.getEndColumn());
-       
+               ParameterizedBuiltinFunctionExpression retVal = new 
ParameterizedBuiltinFunctionExpression(_opcode,
+                               newVarParams, this);
+
                return retVal;
        }
 
@@ -263,7 +271,7 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                int count = 0;
                for (DataIdentifier outParam: stmt.getTargetList()){
                        DataIdentifier tmp = new DataIdentifier(outParam);
-                       tmp.setAllPositions(this.getFilename(), 
this.getBeginLine(), this.getBeginColumn(), this.getEndLine(), 
this.getEndColumn());
+                       tmp.setParseInfo(this);
                        _outputs[count++] = tmp;
                }
                
@@ -412,7 +420,7 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                
                Expression orderby = getVarParam("by"); //[OPTIONAL] BY
                if( orderby == null ) { //default first column, good fit for 
vectors
-                       orderby = new IntIdentifier(1, "1", -1, -1, -1, -1);
+                       orderby = new IntIdentifier(1);
                        addVarParam("by", orderby);
                }
                else if( orderby !=null && orderby.getOutput().getDataType() != 
DataType.SCALAR ){                              
@@ -421,7 +429,7 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                
                Expression decreasing = getVarParam("decreasing"); //[OPTIONAL] 
DECREASING
                if( decreasing == null ) { //default: ascending
-                       addVarParam("decreasing", new BooleanIdentifier(false, 
"false", -1, -1, -1, -1));
+                       addVarParam("decreasing", new BooleanIdentifier(false));
                }
                else if( decreasing!=null && 
decreasing.getOutput().getDataType() != DataType.SCALAR ){                      
   
                        raiseValidateError("Ordering 'decreasing' is of type 
'"+decreasing.getOutput().getDataType()+"', 
'"+decreasing.getOutput().getValueType()+"'. Please, specify 'decreasing' as a 
scalar boolean.", conditional, LanguageErrorCodes.INVALID_PARAMETERS);
@@ -429,7 +437,7 @@ public class ParameterizedBuiltinFunctionExpression extends 
DataIdentifier
                
                Expression indexreturn = getVarParam("index.return"); 
//[OPTIONAL] DECREASING
                if( indexreturn == null ) { //default: sorted data
-                       indexreturn = new BooleanIdentifier(false, "false", -1, 
-1, -1, -1);
+                       indexreturn = new BooleanIdentifier(false);
                        addVarParam("index.return", indexreturn);
                }
                else if( indexreturn!=null && 
indexreturn.getOutput().getDataType() != DataType.SCALAR ){                     
          

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/ParseInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/ParseInfo.java 
b/src/main/java/org/apache/sysml/parser/ParseInfo.java
new file mode 100644
index 0000000..366624b
--- /dev/null
+++ b/src/main/java/org/apache/sysml/parser/ParseInfo.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sysml.parser;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.misc.Interval;
+
+public interface ParseInfo {
+
+       public void setBeginLine(int beginLine);
+
+       public void setBeginColumn(int beginColumn);
+
+       public void setEndLine(int endLine);
+
+       public void setEndColumn(int endColumn);
+
+       public void setText(String text);
+       
+       public void setFilename(String filename);
+
+       public int getBeginLine();
+
+       public int getBeginColumn();
+
+       public int getEndLine();
+
+       public int getEndColumn();
+
+       public String getText();
+       
+       public String getFilename();
+
+       public static ParseInfo ctxAndFilenameToParseInfo(ParserRuleContext 
ctx, String filename) {
+               ParseInfo pi = new ParseInfo() {
+                       private int beginLine;
+                       private int beginColumn;
+                       private int endLine;
+                       private int endColumn;
+                       private String text;
+                       private String filename;
+
+                       @Override
+                       public void setBeginLine(int beginLine) {
+                               this.beginLine = beginLine;
+                       }
+
+                       @Override
+                       public void setBeginColumn(int beginColumn) {
+                               this.beginColumn = beginColumn;
+                       }
+
+                       @Override
+                       public void setEndLine(int endLine) {
+                               this.endLine = endLine;
+                       }
+
+                       @Override
+                       public void setEndColumn(int endColumn) {
+                               this.endColumn = endColumn;
+                       }
+
+                       @Override
+                       public void setText(String text) {
+                               this.text = text;
+                       }
+
+                       @Override
+                       public void setFilename(String filename) {
+                               this.filename = filename;
+                       }
+                       @Override
+                       public int getBeginLine() {
+                               return beginLine;
+                       }
+
+                       @Override
+                       public int getBeginColumn() {
+                               return beginColumn;
+                       }
+
+                       @Override
+                       public int getEndLine() {
+                               return endLine;
+                       }
+
+                       @Override
+                       public int getEndColumn() {
+                               return endColumn;
+                       }
+
+                       @Override
+                       public String getText() {
+                               return text;
+                       }
+                       
+                       @Override
+                       public String getFilename() {
+                               return filename;
+                       }
+               };
+               pi.setBeginLine(ctx.start.getLine());
+               pi.setBeginColumn(ctx.start.getCharPositionInLine());
+               pi.setEndLine(ctx.stop.getLine());
+               pi.setEndColumn(ctx.stop.getCharPositionInLine());
+               // preserve whitespace if possible
+               if ((ctx.start != null) && (ctx.stop != null) && 
(ctx.start.getStartIndex() != -1)
+                               && (ctx.stop.getStopIndex() != -1) && 
(ctx.start.getStartIndex() <= ctx.stop.getStopIndex())
+                               && (ctx.start.getInputStream() != null)) {
+                       String text = ctx.start.getInputStream()
+                                       
.getText(Interval.of(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
+                       if (text != null) {
+                               text = text.trim();
+                       }
+                       pi.setText(text);
+               } else {
+                       String text = ctx.getText();
+                       if (text != null) {
+                               text = text.trim();
+                       }
+                       pi.setText(text);
+               }
+               pi.setFilename(filename);
+               return pi;
+       }
+}

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/PrintStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/PrintStatement.java 
b/src/main/java/org/apache/sysml/parser/PrintStatement.java
index 0193553..16e9e4a 100644
--- a/src/main/java/org/apache/sysml/parser/PrintStatement.java
+++ b/src/main/java/org/apache/sysml/parser/PrintStatement.java
@@ -22,6 +22,7 @@ package org.apache.sysml.parser;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.antlr.v4.runtime.ParserRuleContext;
 import org.apache.sysml.api.DMLScript;
 import org.apache.sysml.debug.DMLBreakpointManager;
 
@@ -43,7 +44,7 @@ public class PrintStatement extends Statement
 
        private static PRINTTYPE getPrintType(String type, List<Expression> 
expressions) throws LanguageException {
                if(type.equalsIgnoreCase("print")) {
-                       if (expressions.size() == 1) {
+                       if ((expressions == null) || (expressions.size() == 1)) 
{
                                return PRINTTYPE.PRINT;
                        } else {
                                return PRINTTYPE.PRINTF;
@@ -56,20 +57,28 @@ public class PrintStatement extends Statement
                        throw new LanguageException("Unknown statement type: " 
+ type);
        }
 
-       public PrintStatement(String type, List<Expression> expressions, int 
beginLine, int beginCol,
-                       int endLine, int endCol) throws LanguageException {
-               this(getPrintType(type, expressions), expressions);
+       public PrintStatement(ParserRuleContext ctx, String type, String 
filename)
+                       throws LanguageException {
+               this(getPrintType(type, null), null);
+               setCtxValues(ctx);
+               setFilename(filename);
+       }
 
-               setBeginLine(beginLine);
-               setBeginColumn(beginCol);
-               setEndLine(endLine);
-               setEndColumn(endCol);
+       public PrintStatement(ParserRuleContext ctx, String type, 
List<Expression> expressions, String filename)
+                       throws LanguageException {
+               this(getPrintType(type, expressions), expressions);
+               setCtxValues(ctx);
+               setFilename(filename);
        }
 
        public PrintStatement(PRINTTYPE type, List<Expression> expressions)
                        throws LanguageException {
                _type = type;
-               this.expressions = expressions;
+               if (expressions == null) {
+                       this.expressions = new ArrayList<Expression>();
+               } else {
+                       this.expressions = expressions;
+               }
        }
 
        public Statement rewriteStatement(String prefix) throws 
LanguageException{
@@ -79,11 +88,7 @@ public class PrintStatement extends Statement
                        newExpressions.add(newExpression);
                }
                PrintStatement retVal = new PrintStatement(_type, 
newExpressions);
-               retVal.setBeginLine(this.getBeginLine());
-               retVal.setBeginColumn(this.getBeginColumn());
-               retVal.setEndLine(this.getEndLine());
-               retVal.setEndColumn(this.getEndColumn());
-               
+               retVal.setParseInfo(this);
                return retVal;
        }
        

http://git-wip-us.apache.org/repos/asf/systemml/blob/c495533b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/parser/RelationalExpression.java 
b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
index 48666d0..8a82b1e 100644
--- a/src/main/java/org/apache/sysml/parser/RelationalExpression.java
+++ b/src/main/java/org/apache/sysml/parser/RelationalExpression.java
@@ -37,26 +37,21 @@ public class RelationalExpression extends Expression
                setBeginColumn(0);
                setEndLine(0);
                setEndColumn(0);
+               setText(null);
        }
-       
-       public RelationalExpression(RelationalOp bop, String filename, int 
beginLine, int beginColumn, int endLine, int endColumn) {
+
+       public RelationalExpression(RelationalOp bop, ParseInfo parseInfo) {
                _opcode = bop;
-               
-               setFilename(filename);
-               setBeginLine(beginLine);
-               setBeginColumn(beginColumn);
-               setEndLine(endLine);
-               setEndColumn(endColumn);
+               setParseInfo(parseInfo);
        }
-       
-       public Expression rewriteExpression(String prefix) throws 
LanguageException{
-               
-               RelationalExpression newExpr = new 
RelationalExpression(this._opcode, getFilename(), getBeginLine(), 
getBeginColumn(), getEndLine(), getEndColumn());
+
+       public Expression rewriteExpression(String prefix) throws 
LanguageException {
+               RelationalExpression newExpr = new 
RelationalExpression(this._opcode, this);
                newExpr.setLeft(_left.rewriteExpression(prefix));
                newExpr.setRight(_right.rewriteExpression(prefix));
                return newExpr;
        }
-       
+
        public RelationalOp getOpCode(){
                return _opcode;
        }
@@ -65,22 +60,18 @@ public class RelationalExpression extends Expression
                _left = l;
                
                // update script location information --> left expression is 
BEFORE in script
-               if (_left != null){
-                       setFilename(_left.getFilename());
-                       setBeginLine(_left.getBeginLine());
-                       setBeginColumn(_left.getBeginColumn());
+               if (_left != null) {
+                       setParseInfo(_left);
                }
-               
+
        }
        
        public void setRight(Expression r){
                _right = r;
                
                // update script location information --> right expression is 
AFTER in script
-               if (_right != null){
-                       setFilename(_right.getFilename());
-                       setBeginLine(_right.getEndLine());
-                       setBeginColumn(_right.getEndColumn());
+               if (_right != null) {
+                       setParseInfo(_right);
                }
        }
        
@@ -110,23 +101,24 @@ public class RelationalExpression extends Expression
                }
                
                // handle <NUMERIC> == <BOOLEAN> --> convert <BOOLEAN> to 
numeric value
-               if ((_left != null && _left instanceof BooleanIdentifier) || 
(_right != null && _right instanceof BooleanIdentifier)){
-                       if ((_left instanceof IntIdentifier || _left instanceof 
DoubleIdentifier) || _right instanceof IntIdentifier || _right instanceof 
DoubleIdentifier){
-                               if (_left instanceof BooleanIdentifier){
+               if ((_left != null && _left instanceof BooleanIdentifier)
+                               || (_right != null && _right instanceof 
BooleanIdentifier)) {
+                       if ((_left instanceof IntIdentifier || _left instanceof 
DoubleIdentifier) || _right instanceof IntIdentifier
+                                       || _right instanceof DoubleIdentifier) {
+                               if (_left instanceof BooleanIdentifier) {
                                        if (((BooleanIdentifier) 
_left).getValue())
-                                               this.setLeft(new 
IntIdentifier(1, _left.getFilename(), _left.getBeginLine(), 
_left.getBeginColumn(), _left.getEndLine(), _left.getEndColumn()));
+                                               this.setLeft(new 
IntIdentifier(1, _left));
                                        else
-                                               this.setLeft(new 
IntIdentifier(0, _left.getFilename(), _left.getBeginLine(), 
_left.getBeginColumn(), _left.getEndLine(), _left.getEndColumn()));
-                               }
-                               else if (_right instanceof BooleanIdentifier){
+                                               this.setLeft(new 
IntIdentifier(0, _left));
+                               } else if (_right instanceof BooleanIdentifier) 
{
                                        if (((BooleanIdentifier) 
_right).getValue())
-                                               this.setRight(new 
IntIdentifier(1, _right.getFilename(), _right.getBeginLine(), 
_right.getBeginColumn(), _right.getEndLine(),_right.getEndColumn()));
+                                               this.setRight(new 
IntIdentifier(1, _right));
                                        else
-                                               this.setRight(new 
IntIdentifier(0,  _right.getFilename(), _right.getBeginLine(), 
_right.getBeginColumn(), _right.getEndLine(),_right.getEndColumn()));
+                                               this.setRight(new 
IntIdentifier(0, _right));
                                }
                        }
                }
-               
+
                //recursive validate
                _left.validateExpression(ids, constVars, conditional);
                if( _right !=null )
@@ -140,7 +132,7 @@ public class RelationalExpression extends Expression
                
                String outputName = getTempName();
                DataIdentifier output = new DataIdentifier(outputName);
-               output.setAllPositions(this.getFilename(), this.getBeginLine(), 
this.getBeginColumn(), this.getEndLine(), this.getEndColumn());
+               output.setParseInfo(this);
                
                boolean isLeftMatrix = (_left.getOutput() != null && 
_left.getOutput().getDataType() == DataType.MATRIX);
                boolean isRightMatrix = (_right.getOutput() != null && 
_right.getOutput().getDataType() == DataType.MATRIX); 

Reply via email to