Examples of lookingAt()


Examples of java.util.regex.Matcher.lookingAt()

                tokens.add(new CharacterToken(position++, ch));
                continue;
            }

            final Matcher numberMatcher = numberPattern.matcher(expression.substring(position));
            if (numberMatcher.lookingAt()) {
                String numberPart = numberMatcher.group(1);
                if (!numberPart.isEmpty()) {
                    try {
                        tokens.add(new NumberToken(position, Double.parseDouble(numberPart)));
                    } catch (NumberFormatException e) {
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

                    continue;
                }
            }

            final Matcher identifierMatcher = identifierPattern.matcher(expression.substring(position));
            if (identifierMatcher.lookingAt()) {
                String identifierPart = identifierMatcher.group(1);
                if (!identifierPart.isEmpty()) {
                    if (keywords.contains(identifierPart)) {
                        tokens.add(new KeywordToken(position, identifierPart));
                    } else {
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

                encoder.endGroup(TokenType.string);
            }
            else if ((m = source.scan(FUNCTION)) != null) {
                encoder.beginGroup(TokenType.function);
                Matcher functionMatcher = FUNCTION_NAME.matcher(m.group());
                functionMatcher.lookingAt();
                String start = functionMatcher.group();
                encoder.textToken(start, TokenType.delimiter);
                if (PARENTHESES_END.matcher(m.group().substring(m.group().length() - 1)).matches()) {
                    if (m.group().length() > start.length() + 1) {
                        encoder.textToken(m.group().substring(start.length(), m.group().length() - 1), TokenType.content);
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

        return scan(Pattern.compile(pattern));
    }

    public MatchResult scan(Pattern pattern) {
        Matcher m = pattern.matcher(sequence);
        if (m.lookingAt()) {
            MatchResult result = new StaticMatchResult(sequence, m);
            sequence.advance(m.end());
            return result;
        }
        return null;
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

        return check(Pattern.compile(pattern));
    }

    public MatchResult check(Pattern pattern) {
        Matcher m = pattern.matcher(sequence);
        if (m.lookingAt()) {
            return new StaticMatchResult(sequence, m);
        }
        return null;
    }
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

    public final Block visit( final String line, final ByLineSource source )
        throws ParseException
    {
        final Matcher m = HEADER_DA.matcher( line );

        if ( !m.lookingAt() )
        {
            throw new IllegalArgumentException( "don't know how to handle: " + line );
        }

        String newLine;
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

            }

            for ( int i = 0; i < patterns.length; i++ )
            {
                final Matcher m = patterns[i].matcher( l );
                if ( m.lookingAt() )
                {
                    final int numberOfSpaces = 3;
                    final int textGroup = 3;
                    assert m.group( 1 ).length() % numberOfSpaces == 0;
                    final int level = m.group( 1 ).length() / numberOfSpaces;
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

        String l = line;

        do
        {
            final Matcher m = TABLE_PATTERN.matcher( l );
            if ( m.lookingAt() )
            {
                final List<Block> cells = new ArrayList<Block>();

                /* for each cell... */
                for ( int lh = l.indexOf( '|' ) + 1, rh; ( rh = l.indexOf( '|', lh ) ) != -1; lh = rh + 1 )
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

    public final boolean accept( final String line )
    {
        final Matcher m = HRULE_PATTERN.matcher( line );
        boolean ret = false;

        if ( m.lookingAt() )
        {
            final int textGroup = 3;
            String s = m.group( textGroup );
            if ( s != null && !s.startsWith( "+" ) )
            {
View Full Code Here

Examples of java.util.regex.Matcher.lookingAt()

    public final Block visit( final String line, final ByLineSource source )
        throws ParseException
    {
        Block ret = new HorizontalRuleBlock();
        final Matcher matcher = HRULE_PATTERN.matcher( line );
        if ( matcher.lookingAt() )
        {
            final int textGroup = 3;
            source.unget( matcher.group( textGroup ) );
        }
        else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.