nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java
changeset 16256 f2d9a0c49914
parent 16241 e23ed61e75a2
child 16258 0e25f785df4d
equal deleted inserted replaced
16255:cb52a2524ca8 16256:f2d9a0c49914
   212     protected final void error(final JSErrorType errorType, final String message, final long errorToken) {
   212     protected final void error(final JSErrorType errorType, final String message, final long errorToken) {
   213         final int position  = Token.descPosition(errorToken);
   213         final int position  = Token.descPosition(errorToken);
   214         final int lineNum   = source.getLine(position);
   214         final int lineNum   = source.getLine(position);
   215         final int columnNum = source.getColumn(position);
   215         final int columnNum = source.getColumn(position);
   216         final String formatted = ErrorManager.format(message, source, lineNum, columnNum, errorToken);
   216         final String formatted = ErrorManager.format(message, source, lineNum, columnNum, errorToken);
   217         final ParserException exp = new ParserException(formatted, source, lineNum, columnNum, errorToken);
   217         throw new ParserException(errorType, formatted, source, lineNum, columnNum, errorToken);
   218         exp.setErrorType(errorType);
       
   219         throw exp;
       
   220     }
   218     }
   221 
   219 
   222     /**
   220     /**
   223      * Report an error.
   221      * Report an error.
   224      *
   222      *
   237     protected final void error(final JSErrorType errorType, final String message) {
   235     protected final void error(final JSErrorType errorType, final String message) {
   238         // TODO - column needs to account for tabs.
   236         // TODO - column needs to account for tabs.
   239         final int position = Token.descPosition(token);
   237         final int position = Token.descPosition(token);
   240         final int column = position - linePosition;
   238         final int column = position - linePosition;
   241         final String formatted = ErrorManager.format(message, source, line, column, token);
   239         final String formatted = ErrorManager.format(message, source, line, column, token);
   242         final ParserException exp = new ParserException(formatted, source, line, column, token);
   240         throw new ParserException(errorType, formatted, source, line, column, token);
   243         exp.setErrorType(errorType);
       
   244         throw exp;
       
   245     }
   241     }
   246 
   242 
   247     /**
   243     /**
   248      * Generate 'expected' message.
   244      * Generate 'expected' message.
   249      *
   245      *