public void reportError(RecognitionException e) { String msg = null; if ( e instanceof NoViableAltException ) { msg = "invalid character '"+(char)input.LA(1)+"'"; } else if ( e instanceof MismatchedTokenException && ((MismatchedTokenException)e).expecting=='"' ) { msg = "unterminated string"; } else { msg = getErrorMessage(e, getTokenNames()); } group.errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); } public String getSourceName() {
match('{'); Token templateToken = new CommonToken(input, ANONYMOUS_TEMPLATE, 0, getCharIndex(), getCharIndex()); STLexer lexer = new STLexer(group.errMgr, input, templateToken, group.delimiterStartChar, group.delimiterStopChar); MismatchedTokenException e = new MismatchedTokenException('}', input); String msg = "missing final '}' in {...} anonymous template"; group.errMgr.groupLexerError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); break;
/** Load a group file with full path {@code fileName}; it's relative to root by {@code prefix}. */ public void loadGroupFile(String prefix, String fileName) { if ( verbose ) System.out.println(this.getClass().getSimpleName()+ ".loadGroupFile(group-file-prefix="+prefix+", fileName="+fileName+")"); GroupParser parser; try { URL f = new URL(fileName); ANTLRInputStream fs = new ANTLRInputStream(f.openStream(), encoding); GroupLexer lexer = new GroupLexer(fs); fs.name = fileName; CommonTokenStream tokens = new CommonTokenStream(lexer); parser = new GroupParser(tokens); parser.group(this, prefix); } catch (Exception e) { errMgr.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, fileName); } }
match('{'); Token templateToken = new CommonToken(input, ANONYMOUS_TEMPLATE, 0, getCharIndex(), getCharIndex()); STLexer lexer = new STLexer(group.errMgr, input, templateToken, group.delimiterStartChar, group.delimiterStopChar); MismatchedTokenException e = new MismatchedTokenException('}', input); String msg = "missing final '}' in {...} anonymous template"; group.errMgr.groupLexerError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); break;
/** Load a group file with full path {@code fileName}; it's relative to root by {@code prefix}. */ public void loadGroupFile(String prefix, String fileName) { if ( verbose ) System.out.println(this.getClass().getSimpleName()+ ".loadGroupFile(group-file-prefix="+prefix+", fileName="+fileName+")"); GroupParser parser; try { URL f = new URL(fileName); ANTLRInputStream fs = new ANTLRInputStream(f.openStream(), encoding); GroupLexer lexer = new GroupLexer(fs); fs.name = fileName; CommonTokenStream tokens = new CommonTokenStream(lexer); parser = new GroupParser(tokens); parser.group(this, prefix); } catch (Exception e) { errMgr.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, fileName); } }
@Override public void reportError(RecognitionException e) { String msg = null; if ( e instanceof NoViableAltException ) { msg = "invalid character '"+(char)input.LA(1)+"'"; } else if ( e instanceof MismatchedTokenException && ((MismatchedTokenException)e).expecting=='"' ) { msg = "unterminated string"; } else { msg = getErrorMessage(e, getTokenNames()); } group.errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); } @Override
match('{'); Token templateToken = new CommonToken(input, ANONYMOUS_TEMPLATE, 0, getCharIndex(), getCharIndex()); STLexer lexer = new STLexer(group.errMgr, input, templateToken, group.delimiterStartChar, group.delimiterStopChar); MismatchedTokenException e = new MismatchedTokenException('}', input); String msg = "missing final '}' in {...} anonymous template"; group.errMgr.groupLexerError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); break;
/** Load a group file with full path {@code fileName}; it's relative to root by {@code prefix}. */ public void loadGroupFile(String prefix, String fileName) { if ( verbose ) System.out.println(this.getClass().getSimpleName()+ ".loadGroupFile(group-file-prefix="+prefix+", fileName="+fileName+")"); GroupParser parser; try { URL f = new URL(fileName); ANTLRInputStream fs = new ANTLRInputStream(f.openStream(), encoding); GroupLexer lexer = new GroupLexer(fs); fs.name = fileName; CommonTokenStream tokens = new CommonTokenStream(lexer); parser = new GroupParser(tokens); parser.group(this, prefix); } catch (Exception e) { errMgr.IOError(null, ErrorType.CANT_LOAD_GROUP_FILE, e, fileName); } }
match('\"'); match('\\'); match('\"'); match('\\'); if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '\uFFFF') ) { input.consume(); recover(mse); throw mse; group.errMgr.groupLexerError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); match('\n'); recover(mse); throw mse; match('\"'); String txt = getText().replaceAll("\\\\\"","\""); setText(txt);
@Override public void reportError(RecognitionException e) { String msg = null; if ( e instanceof NoViableAltException ) { msg = "invalid character '"+(char)input.LA(1)+"'"; } else if ( e instanceof MismatchedTokenException && ((MismatchedTokenException)e).expecting=='"' ) { msg = "unterminated string"; } else { msg = getErrorMessage(e, getTokenNames()); } group.errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); } @Override
match('{'); Token templateToken = new CommonToken(input, ANONYMOUS_TEMPLATE, 0, getCharIndex(), getCharIndex()); STLexer lexer = new STLexer(group.errMgr, input, templateToken, group.delimiterStartChar, group.delimiterStopChar); MismatchedTokenException e = new MismatchedTokenException('}', input); String msg = "missing final '}' in {...} anonymous template"; group.errMgr.groupLexerError(ErrorType.SYNTAX_ERROR, getSourceName(), e, msg); break;