org.modelcc.language.metamodel.LanguageMember Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ModelCC Show documentation
Show all versions of ModelCC Show documentation
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.language.metamodel;
import java.io.Serializable;
import java.util.List;
import org.modelcc.lexer.recognizer.PatternRecognizer;
import org.modelcc.metamodel.Evaluator;
import org.modelcc.metamodel.ModelElement;
/**
* Language model member.
*
* @author Luis Quesada ([email protected]) & Fernando Berzal ([email protected])
*/
public class LanguageMember extends ModelElement implements Serializable
{
/**
* Whether this member is optional.
*/
private boolean optional;
/**
* Whether this member is part of the element key
*/
private boolean key;
/**
* Whether this member is a reference.
*/
private boolean reference;
/**
* Prefix.
*/
private List prefix;
/**
* Suffix.
*/
private List suffix;
/**
* Separator.
*/
private List separator;
/**
* Evaluator.
*/
private Evaluator evaluator;
/**
* Constructor
* @param field the field
* @param elementClass the element class.
*/
public LanguageMember(String field,Class elementClass)
{
super(elementClass,field);
}
/**
* Constructor
* @param field the field
* @param elementClass the element class.
* @param optional whether content is optional or not
* @param key is key
* @param reference is reference
* @param prefix the prefix
* @param suffix the suffix
* @param separator the separator
* @param positionTag the position tag
* @param evaluator the evaluator
*/
public LanguageMember(
String field,
Class elementClass,
boolean optional,
boolean key,
boolean reference,
List prefix,
List suffix,
List separator,
Evaluator evaluator)
{
super(elementClass,field);
this.optional = optional;
this.key = key;
this.reference = reference;
this.prefix = prefix;
this.suffix = suffix;
this.separator = separator;
this.evaluator = evaluator;
}
// Getters
public boolean isOptional() {
return optional;
}
public boolean isKey() {
return key;
}
public boolean isReference() {
return reference;
}
public List getPrefix() {
return prefix;
}
public List getSuffix() {
return suffix;
}
public List getSeparator() {
return separator;
}
public Evaluator getEvaluator() {
return evaluator;
}
// Setters
public void setOptional(boolean optional) {
this.optional = optional;
}
public void setKey(boolean key) {
this.key = key;
}
public void setReference(boolean reference) {
this.reference = reference;
}
public void setPrefix(List prefix) {
this.prefix = prefix;
}
public void setSuffix(List suffix) {
this.suffix = suffix;
}
public void setSeparator(List separator) {
this.separator = separator;
}
public void setEvaluator(Evaluator evaluator) {
this.evaluator = evaluator;
}
}