Package org.rascalmpl.parser

Examples of org.rascalmpl.parser.ParserGenerator


        }
      }
      throw new ImplementationError("class for cached parser " + className + " could not be found");
    }

    ParserGenerator pg = eval.getParserGenerator();
    IMap definitions = currentModule.getSyntaxDefinition();
   
    Class<IGTD<IConstructor, IConstructor, ISourceLocation>> parser = eval.getHeap().getObjectParser(currentModule.getName(), definitions);

    if (parser == null || force) {
      String parserName = currentModule.getName(); // .replaceAll("::", ".");

      parser = pg.getNewParser(eval, loc, parserName, definitions);
      eval.getHeap().storeObjectParser(currentModule.getName(), definitions, parser);
    }

    try {
      return parser.newInstance();
View Full Code Here


 
  @Override
  public IConstructor getGrammar(IRascalMonitor monitor, URI uri) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      String main = uri.getAuthority();
      ModuleEnvironment env = getHeap().getModule(main);
      return pgen.getGrammar(monitor, main, env.getSyntaxDefinition());
    }
    finally {
      setMonitor(old);
    }
  }
View Full Code Here

  }
 
  public IValue diagnoseAmbiguity(IRascalMonitor monitor, IConstructor parseTree) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      return pgen.diagnoseAmbiguity(parseTree);
    }
    finally {
      setMonitor(old);
    }
  }
View Full Code Here

  }
 
  public IConstructor getExpandedGrammar(IRascalMonitor monitor, URI uri) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      String main = uri.getAuthority();
      ModuleEnvironment env = getHeap().getModule(main);
      monitor.startJob("Expanding Grammar");
      return pgen.getExpandedGrammar(monitor, main, env.getSyntaxDefinition());
    }
    finally {
      monitor.endJob(true);
      setMonitor(old);
    }
View Full Code Here

  }
 
  public ISet getNestingRestrictions(IRascalMonitor monitor, IConstructor g) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      return pgen.getNestingRestrictions(monitor, g);
    }
    finally {
      setMonitor(old);
    }
  }
View Full Code Here

    startJob("Loading parser generator", 40);
    if(parserGenerator == null ){
      if (isBootstrapper()) {
        throw new ImplementationError("Cyclic bootstrapping is occurring, probably because a module in the bootstrap dependencies is using the concrete syntax feature.");
      }
      parserGenerator = new ParserGenerator(getMonitor(), getStdErr(), classLoaders, getValueFactory(), config);
    }
    endJob(true);
    return parserGenerator;
  }
View Full Code Here

TOP

Related Classes of org.rascalmpl.parser.ParserGenerator

Copyright © 2018 www.massapicom. 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.