All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.modelcc.lexer.recognizer.PatternRecognizer Maven / Gradle / Ivy

Go to download

ModelCC is a model-based parser generator (a.k.a. compiler compiler) that decouples language specification from language processing, avoiding some of the problems caused by grammar-driven parser generators. ModelCC receives a conceptual model as input, along with constraints that annotate it. It is then able to create a parser for the desired textual language and the generated parser fully automates the instantiation of the language conceptual model. ModelCC also includes a built-in reference resolution mechanism that results in abstract syntax graphs, rather than mere abstract syntax trees.

The newest version!
/*
 * ModelCC, distributed under ModelCC Shared Software License, www.modelcc.org
 */

package org.modelcc.lexer.recognizer;

import java.io.Serializable;

/**
 * Pattern recognizer abstract class.
 * 
 * @author Luis Quesada ([email protected]) & Fernando Berzal ([email protected])
 */
public abstract class PatternRecognizer implements Serializable
{
    /**
     * Try to match the pattern in a certain position of a char sequence.
     * @param cs the char sequence in which to match the pattern.
     * @param start the position of the char sequence in which to match the pattern.
     * @return an object that contains the matched subsequence if there was a match, null otherwise.
     */
    public abstract MatchedObject read (CharSequence cs, int start);
    
    /**
     * Pattern recognition.
     * @param cs the input char sequence.
     * @return an object that contains the matched object if there was a match, null otherwise.
     */
    public final MatchedObject read (CharSequence cs)
    {
    	return read(cs,0);
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy