public boolean matchOperator( String token, boolean bPeek ) { boolean bMatch = _tokenizer.getType() == ISourceCodeTokenizer.TT_OPERATOR && token.equalsIgnoreCase( _tokenizer.getStringValue() ); if( bMatch && !bPeek ) { _tokenizer.nextToken(); } return bMatch; }
Scanner( Reader reader, ITokenizerInstructor instructor ) { _tokenizer = GosuShop.createSourceCodeTokenizer( reader ); // Initialize the tokenizer _tokenizer.setWhitespaceSignificant( true ); _tokenizer.setCommentsSignificant( true ); _tokenizer.setParseDotsAsOperators( true ); _tokenizer.wordChars( '_', '_' ); if( instructor != null ) { _tokenizer.setInstructor( instructor.createNewInstance( _tokenizer ) ); } }
/** * This fetches the ending location of the current * token in the document. */ public final int getEndOffset() { int endOffs = _tokenizer.getTokenEnd(); return _p0 + endOffs; }
private GosucProjectParser( String strContent ) { _tokenizer = makeTokenizer(strContent); _tokenizer.wordChars( '_', '_' ); _tokenizer.wordChars( '-', '-' ); _tokenizer.setSupportsKeywords( false ); }
public int getType() { return _tokenizer.getType(); }
static boolean matchDeclarationKeyword( String[] ret, boolean bPeek, ISourceCodeTokenizer tokenizer ) IToken token = tokenizer.getCurrentToken(); if( token.getType() == ISourceCodeTokenizer.TT_KEYWORD ) int mark = tokenizer.mark(); IToken nextToken = tokenizer.getTokenAt( mark + 1 ); IToken priorToken = mark == 0 ? null : tokenizer.getTokenAt( mark - 1 ); bMatch = (nextToken == null || nextToken.getType() != '.') && (priorToken == null || (priorToken.getType() != '.' && !"#".equals( priorToken.getStringValue() ))); if( !bPeek ) tokenizer.nextToken();
public GosuClassLightParser(String text) { lexer = GosuShop.createSourceCodeTokenizer(text); lexer.setCommentsSignificant(false); lexer.setWhitespaceSignificant(false); }
static boolean match( IToken T, String strToken, int iType, boolean bPeek, ISourceCodeTokenizer tokenizer ) { boolean bMatch = false; if( T != null ) { tokenizer.copyInto( T ); } IToken currentToken = tokenizer.getCurrentToken(); int iCurrentType = currentToken.getType(); if( strToken != null ) { if( (iType == iCurrentType) || ((iType == 0) && (iCurrentType == ISourceCodeTokenizer.TT_WORD)) ) { bMatch = strToken.equals( currentToken.getStringValue() ); } } else { bMatch = (iCurrentType == iType) || (iType == ISourceCodeTokenizer.TT_WORD && currentToken.isValueKeyword()); } if( bMatch && !bPeek ) { tokenizer.nextToken(); } return bMatch; }
private static List<String> parsePathList( GosucProjectParser parser ) { List<String> paths = new ArrayList<>(); for (IToken t = parser.getTokenizer().getCurrentToken(); parser.match(null, '"', false); t = parser.getTokenizer().getCurrentToken()) { paths.add(t.getStringValue()); if (!parser.match(null, ',', false)) { break; } } return paths; }
public void nextToken() throws IOException { _tokenizer.nextToken(); } }
while( tokenizer.getCurrentToken().getTokenStart() < caretPos ) tokenizer.nextToken(); IToken startToken = tokenizer.getCurrentToken(); if( startToken == null ) tokenizer.nextToken(); IToken endToken = IParserPart.eatBlock( '{', '}', false, tokenizer );
/** * This fetches the starting location of the current * token in the document. */ public final int getStartOffset() { int begOffs = _tokenizer.getTokenStart(); return _p0 + begOffs; }
public int getType() { return _tokenizer.getType(); }
do IToken token = tokenizer.getCurrentToken(); tokenizer.nextToken(); return null; int mark = tokenizer.mark(); if( cEnd == type || (bOperator && type == ISourceCodeTokenizer.TT_OPERATOR && value.equals( String.valueOf( cEnd ) )) ) tokenizer.nextToken(); if( --iBraceDepth == 0 ) return (IToken)tokenizer.getTokenAt( mark ).copy(); (bOperator && type == ISourceCodeTokenizer.TT_OPERATOR && value.equals( String.valueOf( cBegin ) )) ) tokenizer.nextToken(); iBraceDepth++; continue; tokenizer.nextToken(); } while( true );
public GosuClassLightParser(String text) { lexer = GosuShop.createSourceCodeTokenizer(text); lexer.setCommentsSignificant(false); lexer.setWhitespaceSignificant(false); }
private static List<String> parseGlobalLoaderList( GosucProjectParser parser ) { List<String> paths = new ArrayList<String>(); for( IToken t = parser.getTokenizer().getCurrentToken(); parser.match( null, '"', false ); t = parser.getTokenizer().getCurrentToken() ) { paths.add( t.getStringValue() ); if( !parser.match( null, ',', false ) ) { break; } } return paths; }
public void nextToken() throws IOException { _tokenizer.nextToken(); } }
private GosucProjectParser( String strContent ) { _tokenizer = makeTokenizer(strContent); _tokenizer.wordChars( '_', '_' ); _tokenizer.wordChars( '-', '-' ); _tokenizer.setSupportsKeywords( false ); }