Examples of SourceRange


Examples of melnorme.lang.tooling.ast.SourceRange

    return sourceEnd - sourceStart;
  }
 
  public final SourceRange getSourceRange() {
    assertTrue(hasSourceRangeInfo());
    return new SourceRange(getStartPos(), getLength());
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

       
        ParserError error = decodeError(lexSource, mde);
        expectedErrors.add(error);
       
        if(getErrorTypeFromMDE(mde) == ParserErrorTypes.INVALID_TOKEN_CHARACTERS) {
          SourceRange sr = error.sourceRange;
          errorCorrectionMetadata.add(new StringCorrection(sr.getOffset(), sr.getLength(), ""));
        } else if(getErrorTypeFromMDE(mde) == ParserErrorTypes.EXPECTED_TOKEN) {
          assertTrue(mde.sourceValue == null || mde.sourceValue.isEmpty() || !mde.sourceWasIncluded);
         
          String rpl = mde.sourceValue;
          if(rpl == null) {
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

 
  public static ParserError decodeError(LexElementSource lexSource, MetadataEntry mde) {
    String errorTypeStr = StringUtil.substringUntilMatch(mde.value, "_");
    String errorParam = StringUtil.segmentAfterMatch(mde.value, "_");
   
    SourceRange errorRange = mde.getSourceRange();
    String errorSource = null;
   
    ParserErrorTypes errorType = getErrorTypeFromMDE(mde);
    switch (errorType) {
    case INVALID_TOKEN_CHARACTERS:
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    LexElementSource lexSource, boolean tokenBefore, Object errorParam) {
    IToken adjacentToken = tokenBefore
      ? findLastEffectiveTokenBeforeOffset(mde.offset, lexSource)
      : findNextEffectiveTokenAfterOffset(mde.offset, lexSource);
     
    SourceRange errorRange = adjacentToken.getSourceRange();
    String errorSource = adjacentToken.getSourceValue();
    return new ParserError(errorTypeTk, errorRange, errorSource, errorParam);
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

  @Test
  public void testInit() throws Exception { testInit$(); }
  public void testInit$() throws Exception {
    LexElementSource lexSource = LexElementProducer.createFromLexer(new TestsInstrumentedLexer("abcdefgh"));
   
    assertEquals(lexSource.lastLexElement.getSourceRange(), new SourceRange(0, 0));
   
    assertTrue(lexSource.lexElementList.size() == 5);
    assertEquals(lexSource.lookAheadElement(4).type, DeeTokens.EOF);
    assertEquals(lexSource.lookAheadElement(5).type, DeeTokens.EOF); // Test index beyond first EOF
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    assertTrue(lookAhead() == DeeTokens.EOF);
    advanceSubChannelTokens(); // Ensure pending whitespace is consumed as well
    assertTrue(getSourcePosition() == lookAheadElement().getStartPos());
    //assertTrue(getSourcePosition() == getSource().length()); //This is not true if explicit EOF token is present
   
    SourceRange modRange = new SourceRange(0, getSourcePosition());
   
    if(md != null) {
      return result(false, conclude(modRange,
        new Module(md.getModuleSymbol(), md, members, compilationUnitPath)));
    } else {
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    jsonWriter.writeProperty("extendedName", result.extendedName);
    jsonWriter.writeProperty("isIntrinsic", result.isLanguageIntrinsic);
    if(result.modulePath != null) {
      jsonWriter.writeProperty("modulePath", result.modulePath.toString());
    }
    SourceRange sourceRange = result.sourceRange;
    if(sourceRange != null) {
      jsonWriter.writeProperty("offset", sourceRange.getOffset());
      jsonWriter.writeProperty("length", sourceRange.getLength());
    }
    jsonWriter.endObject();
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    ParseRuleDescription expectedRule = reportMissingError ? RULE_REFERENCE : null;
    return parseMissingTypeReference(expectedRule);
  }
 
  public Reference parseMissingTypeReference(ParseRuleDescription expectedRule) {
    SourceRange sourceRange = consumeSubChannelTokensNoError().getSourceRange();
    ParserError error = expectedRule != null ? createErrorExpectedRule(expectedRule) : null;
    return createMissingTypeReferenceNode(sourceRange, error);
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    return startPos + source.length();
  }
 
  @Override
  public final SourceRange getSourceRange() {
    return new SourceRange(getStartPos(), getLength());
  }
View Full Code Here

Examples of melnorme.lang.tooling.ast.SourceRange

    if(fdResultEntry == null || fdResultEntry.isLanguageIntrinsic()) {
      dialogInfo("Cannot open definition, "
          + "symbol \"" +fdResultEntry.extendedName + "\" is a language intrinsic.");
      return;
    }
    final SourceRange sourceRange = fdResultEntry.sourceRange;
    if(sourceRange == null) {
      String msg = "Symbol " + fdResultEntry.extendedName + " has no source range info!";
      throw LangCore.createCoreException(msg, null);
    }
   
View Full Code Here
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.