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

org.modelcc.language.metamodel.MemberPositionMetadata 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.language.metamodel;

import java.io.Serializable;

import org.modelcc.SeparatorPolicy;

/**
 * Member position metadata.
 * 
 * @author Luis Quesada ([email protected])
 */
public class MemberPositionMetadata implements Serializable 
{
	private LanguageMember member;
	
	private int[] position;
	
	private SeparatorPolicy separatorPolicy;
	
	public MemberPositionMetadata(LanguageMember member,int[] position,SeparatorPolicy separatorPolicy) 
	{
		this.member = member;
		this.position = position;
		this.separatorPolicy = separatorPolicy;
	}

	public LanguageMember getMember() {
		return member;
	}

	public int[] getPosition() {
		return position;
	}

	public SeparatorPolicy getSeparatorPolicy() {
		return separatorPolicy;
	}

	public boolean contains(int needle) {
		for (int i = 0;i < position.length;i++)
			if (position[i]==needle)
				return true;
		return false;
	}

	public boolean isEmpty() {
		return position.length==0;
	}	  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy