Package de.monticore.antlr4
Class MCConcreteParser
java.lang.Object
de.monticore.antlr4.MCConcreteParser
A MCConcreteParser is used for every single language. MCConcreteParser wrap
around an antlr parser, for having a parse method for a specific rule and
access in a type safe way
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true, if errors occurred while parsingImplement this method to call top rule of parser.Implement this method to call top rule of parser.voidsetError(boolean value)
-
Field Details
-
hasErrors
protected boolean hasErrors
-
-
Constructor Details
-
MCConcreteParser
public MCConcreteParser()Creates a MCConcreteParser with a certain name
-
-
Method Details
-
parse
Implement this method to call top rule of parser. This method will be overridden in generated classes with covariant return type.- Parameters:
fileName- The name of the file to be parsed- Returns:
- An Optional of the created AST
- Throws:
IOException- Errors during file handling
-
parse
Implement this method to call top rule of parser. This method will be overridden in generated classes with covariant return type.- Parameters:
reader- The reader containing the input to be parsed- Returns:
- An Optional of the created AST
- Throws:
IOException- Errors during reader handling
-
hasErrors
public boolean hasErrors()Returns true, if errors occurred while parsing- Returns:
- whether we have errors
-
setError
public void setError(boolean value) -
parse
public Optional<? extends ASTNode> parse(Reader reader, String qualifiedModelName) throws IOException - Throws:
IOException
-