Java 类org.eclipse.xtext.CharacterRange 实例源码

项目:xtext-extras    文件:TerminalRuleInterpreter.java   
@Override
public Boolean caseCharacterRange(CharacterRange object) {
    boolean result = false;
    if (object.getLeft().getValue().length() != 1 || object.getRight().getValue().length() != 1)
        throw new IllegalStateException("ranges cannot use strings as left or right, that are longer then 1 character.");
    OUTER: do {
        if (eof())
            break OUTER;
        char left = object.getLeft().getValue().charAt(0);
        char right = object.getRight().getValue().charAt(0);
        char candidate = input.charAt(input.getOffset());
        if (left <= candidate && right >= candidate) {
            input.incOffset();
            result = true;
            continue OUTER;
        }
        break OUTER;
    } while(GrammarUtil.isMultipleCardinality(object));
    return result || GrammarUtil.isOptionalCardinality(object);
}
项目:xtext-extras    文件:TerminalRuleToLexerBody.java   
@Override
public String caseCharacterRange(CharacterRange object) {
    if (!Strings.isEmpty(object.getCardinality()))
        result.append('(');
    doSwitch(object.getLeft());
    result.append("..");
    doSwitch(object.getRight());
    if (!Strings.isEmpty(object.getCardinality())) {
        result.append(')');
        result.append(Strings.emptyIfNull(object.getCardinality()));
    }
    return "";
}
项目:xtext-core    文件:XtextSemanticSequencer.java   
/**
 * Contexts:
 *     CharacterRange returns CharacterRange
 *
 * Constraint:
 *     (left=CharacterRange_CharacterRange_1_0 right=Keyword)
 */
protected void sequence_CharacterRange(ISerializationContext context, CharacterRange semanticObject) {
    if (errorAcceptor != null) {
        if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.CHARACTER_RANGE__LEFT) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.CHARACTER_RANGE__LEFT));
        if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.CHARACTER_RANGE__RIGHT) == ValueTransient.YES)
            errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.CHARACTER_RANGE__RIGHT));
    }
    SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
    feeder.accept(grammarAccess.getCharacterRangeAccess().getCharacterRangeLeftAction_1_0(), semanticObject.getLeft());
    feeder.accept(grammarAccess.getCharacterRangeAccess().getRightKeywordParserRuleCall_1_2_0(), semanticObject.getRight());
    feeder.finish();
}
项目:xtext-core    文件:TerminalRuleToLexerBody.java   
@Override
public String caseCharacterRange(CharacterRange object) {
    if (!Strings.isEmpty(object.getCardinality()))
        result.append('(');
    doSwitch(object.getLeft());
    result.append("..");
    doSwitch(object.getRight());
    if (!Strings.isEmpty(object.getCardinality())) {
        result.append(')');
        result.append(Strings.emptyIfNull(object.getCardinality()));
    }
    return "";
}
项目:bts    文件:SLCommentPrefixCalculator.java   
@Override
public Boolean caseCharacterRange(CharacterRange object) {
    return false;
}
项目:xtext-core    文件:XtextSemanticSequencer.java   
/**
 * Contexts:
 *     TerminalAlternatives returns CharacterRange
 *     TerminalAlternatives.Alternatives_1_0 returns CharacterRange
 *     TerminalGroup returns CharacterRange
 *     TerminalGroup.Group_1_0 returns CharacterRange
 *     TerminalToken returns CharacterRange
 *     TerminalTokenElement returns CharacterRange
 *     ParenthesizedTerminalElement returns CharacterRange
 *
 * Constraint:
 *     (left=CharacterRange_CharacterRange_1_0 right=Keyword (cardinality='?' | cardinality='*' | cardinality='+')*)
 */
protected void sequence_CharacterRange_TerminalToken(ISerializationContext context, CharacterRange semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}