Class MCConcreteParser

java.lang.Object
de.monticore.antlr4.MCConcreteParser

public abstract class MCConcreteParser extends Object
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 Details

    • hasErrors

      protected boolean hasErrors
  • Constructor Details

    • MCConcreteParser

      public MCConcreteParser()
      Creates a MCConcreteParser with a certain name
  • Method Details

    • parse

      public abstract Optional<? extends ASTNode> parse(String fileName) throws IOException
      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

      public abstract Optional<? extends ASTNode> parse(Reader reader) throws IOException
      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