|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.mtl.parser.MTLSourceBuffer
public class MTLSourceBuffer
The source to parse. It can be created from a file or a buffer. The file property is null if this object has been created from a buffer. You can create an AST model with the method 'createAST'. An AST is created in a single resource. All the dependencies of this resource will be searched in the other resources of the same 'ResourceSet'. You can resolve the links between the different AST models of the current 'ResourceSet' with the method 'resolveAST'. The parsing issues are accessible by using the method 'getProblems'.
The resolution step must always be done at the end of the parsing of each file of the 'ResourceSet', like in the following example.
Resource resource1 = resourceSet.createResource(uriTarget1);
Resource resource2 = resourceSet.createResource(uriTarget2);
MTLSourceBuffer source1 = new MTLSourceBuffer(file1);
MTLSourceBuffer source2 = new MTLSourceBuffer(file1);
source1.createAST(resource1);
source2.createAST(resource2);
source1.resolveAST();
source2.resolveAST();
| Field Summary | |
|---|---|
protected java.lang.StringBuffer |
buffer
The buffer to parse. |
protected java.io.File |
file
The file to parse, can be null if the object is created with a buffer. |
protected MTLParserProblems |
problems
Parsing problems. |
| Constructor Summary | |
|---|---|
MTLSourceBuffer(java.io.File file)
Constructor. |
|
MTLSourceBuffer(java.lang.StringBuffer buffer)
Constructor. |
|
| Method Summary | |
|---|---|
void |
createAST(org.eclipse.emf.ecore.resource.Resource resource)
Creates the AST model. |
Module |
getAST()
Gets the AST model. |
java.lang.StringBuffer |
getBuffer()
Returns the string buffer to parse. |
java.io.File |
getFile()
Returns the parsed file, can be null if the object is created with a buffer. |
MTLParserProblems |
getProblems()
Gets parsing issues. |
void |
log(java.lang.String message,
int posBegin,
int posEnd)
To log a new problem. |
void |
resolveAST()
Resolution step of the AST creation: OCL and invocations. |
int[] |
trim(int posBegin,
int posEnd)
Gets the smallest range that contains all the significant characters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.io.File file
protected final java.lang.StringBuffer buffer
protected final MTLParserProblems problems
| Constructor Detail |
|---|
public MTLSourceBuffer(java.io.File file)
file - is the file to parsepublic MTLSourceBuffer(java.lang.StringBuffer buffer)
buffer - is the buffer to parse, the file property will be null| Method Detail |
|---|
public java.io.File getFile()
public MTLParserProblems getProblems()
public java.lang.StringBuffer getBuffer()
public Module getAST()
getAST in interface IASTProviderpublic void createAST(org.eclipse.emf.ecore.resource.Resource resource)
createAST in interface IASTProviderresource - where the AST will be storedIASTProvider.createAST(org.eclipse.emf.ecore.resource.Resource)public void resolveAST()
resolveAST in interface IASTProviderIASTProvider.resolveAST()
public void log(java.lang.String message,
int posBegin,
int posEnd)
log in interface IASTLogHandlermessage - is the messageposBegin - is the beginning index of the problemposEnd - is the ending index of the problemIASTLogHandler.log(java.lang.String, int, int)
public int[] trim(int posBegin,
int posEnd)
posBegin - is the beginning index of the rangeposEnd - is the ending index of the range
String.trim()
|
Copyright 2008 Obeo All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||