Class ParseHelper

    • Field Detail

      • fileExt

        @Inject
        public String fileExt
    • Constructor Detail

      • ParseHelper

        public ParseHelper()
        Constructor. Uses "UTF-8" encoding by default
      • ParseHelper

        public ParseHelper​(Charset encoding)
        Constructor
        Parameters:
        encoding - - the encoding to use
    • Method Detail

      • parse

        public <T> T parse​(String textToParse,
                           org.eclipse.emf.common.util.URI uri,
                           org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                           Map<?,​?> options,
                           List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> outputErrors)
        Parses text of xtext languge.
        Try to use EmbeddedEditorResourceProvider for creating XtextResource
        Specified by:
        parse in interface IParseHelper
        Type Parameters:
        T - type of the root language grammar element
        Parameters:
        textToParse - text of language
        uri - URI of created resource
        resourceSet - ResourceSet of created resource
        options - the load options
        outputErrors - empty list of output errors, will be filled with parse errors during method execution, cannot be null
        Returns:
        the root element of the language model
        Throws:
        ClassCastException - if the root language element can't be cast to T
      • parse

        public <T> T parse​(String textToParse,
                           org.eclipse.emf.common.util.URI uri,
                           Map<?,​?> options,
                           List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> outputErrors)
        Parses text of xtext languge.
        Specified by:
        parse in interface IParseHelper
        Type Parameters:
        T - type of the root language grammar element
        Parameters:
        textToParse - text of language
        uri - URI of created resource
        options - the load options
        outputErrors - empty list of output errors, will be filled with parse errors during method execution, cannot be null
        Returns:
        the root element of the language model
        Throws:
        ClassCastException - if the root language element can't be cast to T