Package org.csu.idl.xtext.parser.antlr

Source Code of org.csu.idl.xtext.parser.antlr.IDLParser

/*
* generated by Xtext
*/
package org.csu.idl.xtext.parser.antlr;

import org.antlr.runtime.CharStream;
import org.antlr.runtime.TokenSource;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.parser.ParseException;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;

import com.google.inject.Inject;

import org.csu.idl.xtext.services.IDLGrammarAccess;

public class IDLParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParser {
 
  @Inject
  private IDLGrammarAccess grammarAccess;
 
  @Override
  protected IParseResult parse(String ruleName, CharStream in) {
    TokenSource tokenSource = createLexer(in);
    XtextTokenStream tokenStream = createTokenStream(tokenSource);
    tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT");
    org.csu.idl.xtext.parser.antlr.internal.InternalIDLParser parser = createParser(tokenStream);
    parser.setTokenTypeMap(getTokenDefProvider().getTokenDefMap());
    parser.setSyntaxErrorProvider(getSyntaxErrorProvider());
    parser.setUnorderedGroupHelper(getUnorderedGroupHelper().get());
    try {
      if(ruleName != null)
        return parser.parse(ruleName);
      return parser.parse();
    } catch (Exception re) {
      throw new ParseException(re.getMessage(),re);
    }
  }
 
  protected org.csu.idl.xtext.parser.antlr.internal.InternalIDLParser createParser(XtextTokenStream stream) {
    return new org.csu.idl.xtext.parser.antlr.internal.InternalIDLParser(stream, getElementFactory(), getGrammarAccess());
  }
 
  @Override
  protected String getDefaultRuleName() {
    return "specification";
  }
 
  public IDLGrammarAccess getGrammarAccess() {
    return this.grammarAccess;
  }
 
  public void setGrammarAccess(IDLGrammarAccess grammarAccess) {
    this.grammarAccess = grammarAccess;
  }
 
}
TOP

Related Classes of org.csu.idl.xtext.parser.antlr.IDLParser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.