public final void mSINGLE_LINE_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = SINGLE_LINE_COMMENT; int _saveIndex; Token content=null; match("//"); if ( inputState.guessing==0 ) { mCommentListener.reportSingleLineComment("//", getLine(), getColumn() - 3); } mSINGLE_LINE_COMMENT_CONTENT(true); content=_returnToken; if ( inputState.guessing==0 ) { text.setLength(_begin); text.append(content.getText()); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
text.setLength(_begin); text.append(content.getText());
public final void setLength(int newLength) { if (newLength < length) { length = newLength; } else { while (newLength > length) { append('\0'); } } }
public void append(char c) { if (saveConsumedInput) { text.append(c); } }
public void append(String s) { if (saveConsumedInput) { text.append(s); } }
public final void append(String s) { for (int i = 0; i < s.length(); i++) { append(s.charAt(i)); } }
public void setText(String s) { resetText(); text.append(s); }
/** * Replaces the tab char last read into the text buffer with an * equivalent number of spaces. Note that we assume you know what you do, * we don't check if indeed the tab char were read! * * @throws CharStreamException if an I/O error occured. */ protected void replaceTab() throws CharStreamException { if (_tabString == null) { int tabSize = getTabSize(); // makes for faster array access StringBuffer indent = new StringBuffer(tabSize); for (int i = 0; i < tabSize; i++) { indent.append(' '); } _tabString = indent.toString(); } // remove the tab char from the buffer this.text.setLength(text.length() - 1); // and insert the spaces this.text.append(_tabString); }
protected final void mESCAPED_DOLLAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ESCAPED_DOLLAR; int _saveIndex; match('$'); match('$'); if ( inputState.guessing==0 ) { text.setLength(_begin); text.append('$'); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
protected final void mESCAPED_SLASH(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = ESCAPED_SLASH; int _saveIndex; match('$'); match('/'); if ( inputState.guessing==0 ) { text.setLength(_begin); text.append('/'); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
protected final void mSTRING_NL(boolean _createToken, boolean allowNewline ) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = STRING_NL; int _saveIndex; if ( inputState.guessing==0 ) { if (!allowNewline) throw new MismatchedCharException('\n', '\n', true, this); } mONE_NL(false,false); if ( inputState.guessing==0 ) { text.setLength(_begin); text.append('\n'); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
protected final void mSTRING_NL(boolean _createToken, boolean allowNewline ) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = STRING_NL; int _saveIndex; if ( inputState.guessing==0 ) { if (!allowNewline) throw new MismatchedCharException('\n', '\n', true, this); } mONE_NL(false,false); if ( inputState.guessing==0 ) { text.setLength(_begin); text.append('\n'); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
protected final void mSTRING_NL(boolean _createToken, boolean allowNewline ) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = STRING_NL; int _saveIndex; if ( inputState.guessing==0 ) { if (!allowNewline) throw new MismatchedCharException('\n', '\n', true, this); } mONE_NL(false,false); if ( inputState.guessing==0 ) { text.setLength(_begin); text.append('\n'); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
text.setLength(_begin); text.append(lBuf.toString()); if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype);
text.append(new Character(c).toString());
public final void mSINGLE_LINE_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = SINGLE_LINE_COMMENT; int _saveIndex; Token content=null; match("//"); if ( inputState.guessing==0 ) { mCommentListener.reportSingleLineComment("//", getLine(), getColumn() - 3); } mSINGLE_LINE_COMMENT_CONTENT(true); content=_returnToken; if ( inputState.guessing==0 ) { text.setLength(_begin); text.append(content.getText()); } if ( _createToken && _token==null && _ttype!=Token.SKIP ) { _token = makeToken(_ttype); _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); } _returnToken = _token; }
text.setLength(_begin); text.append(content.getText());
text.setLength(_begin); text.append("#");
text.append("#");