Search in sources :

Example 1 with ConstantDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor in project TrufflePascal by Aspect26.

the class FatalError method CaseConstantList.

List<ConstantDescriptor> CaseConstantList() {
    List<ConstantDescriptor> caseConstants;
    caseConstants = new ArrayList<>();
    ConstantDescriptor constant = Constant();
    caseConstants.add(constant);
    while (la.kind == 10) {
        Get();
        constant = Constant();
        caseConstants.add(constant);
    }
    return caseConstants;
}
Also used : ConstantDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)

Example 2 with ConstantDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor in project TrufflePascal by Aspect26.

the class FatalError method Constant.

ConstantDescriptor Constant() {
    ConstantDescriptor constant;
    constant = null;
    String sign = "";
    if (la.kind == 27 || la.kind == 28) {
        if (la.kind == 27) {
            Get();
        } else {
            Get();
            sign = t.val;
        }
    }
    if (la.kind == 3) {
        long value = UnsignedIntegerLiteral();
        constant = factory.createNumericConstant(sign, value);
    } else if (la.kind == 4) {
        double value = UnsignedDoubleLiteral();
        constant = factory.createDoubleConstant(sign, value);
    } else if (la.kind == 2) {
        String value = StringLiteral();
        constant = factory.createCharOrStringConstant(sign, value);
    } else if (la.kind == 1) {
        Token identifier = IdentifierConstant();
        constant = factory.createConstantFromIdentifier(sign, identifier);
    } else
        SynErr(68);
    return constant;
}
Also used : ConstantDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)

Example 3 with ConstantDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor in project TrufflePascal by Aspect26.

the class FatalError method CaseConstantList.

List<ConstantDescriptor> CaseConstantList() {
    List<ConstantDescriptor> caseConstants;
    caseConstants = new ArrayList<>();
    ConstantDescriptor constant = Constant();
    caseConstants.add(constant);
    while (la.kind == 10) {
        Get();
        constant = Constant();
        caseConstants.add(constant);
    }
    return caseConstants;
}
Also used : ConstantDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)

Example 4 with ConstantDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor in project TrufflePascal by Aspect26.

the class FatalError method SubrangeType.

OrdinalDescriptor SubrangeType() {
    OrdinalDescriptor ordinal;
    ConstantDescriptor lowerBound = Constant();
    Expect(25);
    ConstantDescriptor upperBound = Constant();
    ordinal = factory.createSimpleOrdinalDescriptor(lowerBound, upperBound);
    return ordinal;
}
Also used : ConstantDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor) OrdinalDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.OrdinalDescriptor)

Example 5 with ConstantDescriptor

use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor in project TrufflePascal by Aspect26.

the class FatalError method ConstantDefinition.

void ConstantDefinition() {
    Expect(1);
    Token identifier = t;
    Expect(13);
    ConstantDescriptor constant = Constant();
    factory.registerConstant(identifier, constant);
}
Also used : ConstantDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)

Aggregations

ConstantDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.constant.ConstantDescriptor)12 OrdinalDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex.OrdinalDescriptor)4 TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)2