Package org.jwall.log.io.ParserGenerator

Examples of org.jwall.log.io.ParserGenerator.Token


        this.reset();
        Map<String,String> reads = new LinkedHashMap<String,String>();
        reads.putAll( defaults );

        for( int i = 0; i < tokens.size(); i++ ){
            Token token = tokens.get( i );
            Token next = null;
            if( i+1 < tokens.size() )
                next = tokens.get( i + 1 );
            //skipBlanks( str );
            log.debug( "Remainder string: '{}'", remainder( str ) );

            if( !token.isVariable() ){
                log.debug( "Next token is a constant '{}'", token.getValue() );
                int start = pos;

                if( token.isRegex() ){
                    int len = token.skipLength( remainder( str ) );
                    this.pos += len;
                } else {
                    String val = prefix( str, token.getValue().length() );
                    log.debug( "   const read: '{}'", val );
                    if( !token.getValue().equals( val ) )
                        throw new ParseException( "Failed to read '" + token.getValue() + "', found: " + val + " at position " + start );
                    else
                        this.pos += token.getValue().length();
                }
            } else {
                log.debug( "Next token is a variable '{}'", token.getValue() );
                String val = null;

                if( token.isRegex() ){
                    String rem = remainder( str );
                    int len = token.skipLength( rem );
                    val = rem.substring( 0, len );
                    this.pos += len;
                    reads.put( token.getName(), val );
                } else {
                    if( next != null && !next.isVariable() )
                        val = readTokenUntil( str, next.getValue() );
                    else {
                        if( next == null )
                            val = remainder( str );
                        else
                            val = readToken( str );
View Full Code Here

TOP

Related Classes of org.jwall.log.io.ParserGenerator.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.