Search in sources :

Example 6 with AMachineHeader

use of de.be4.classicalb.core.parser.node.AMachineHeader in project probparsers by bendisposto.

the class RulesReferencesFinder method caseAMachineHeader.

@Override
public void caseAMachineHeader(AMachineHeader node) {
    machineName = Utils.getTIdentifierListAsString(node.getName());
    if (mainFile != null) {
        final String fileNameWithoutExtension = Utils.getFileWithoutExtension(mainFile.getName());
        if (!machineName.equals(fileNameWithoutExtension)) {
            CheckException ch = new CheckException(String.format("RULES_MACHINE name must match the file name: '%s' vs '%s'", machineName, fileNameWithoutExtension), node);
            errorList.add(ch);
        }
    }
}
Also used : CheckException(de.be4.classicalb.core.parser.exceptions.CheckException) TPragmaIdOrString(de.be4.classicalb.core.parser.node.TPragmaIdOrString)

Example 7 with AMachineHeader

use of de.be4.classicalb.core.parser.node.AMachineHeader in project prob2 by bendisposto.

the class DomBuilder method outAMachineHeader.

@Override
public void outAMachineHeader(final AMachineHeader node) {
    name = extractIdentifierName(node.getName());
    machineId = node.getName();
    if (prefix != null && !prefix.equals(name)) {
        name = prefix + "." + name;
    }
    for (PExpression expression : node.getParameters()) {
        parameters.add(new Parameter(createExpressionAST(expression)));
    }
}
Also used : PExpression(de.be4.classicalb.core.parser.node.PExpression)

Aggregations

CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)3 AAbstractMachineParseUnit (de.be4.classicalb.core.parser.node.AAbstractMachineParseUnit)2 AMachineHeader (de.be4.classicalb.core.parser.node.AMachineHeader)2 PExpression (de.be4.classicalb.core.parser.node.PExpression)2 Start (de.be4.classicalb.core.parser.node.Start)2 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)2 TPragmaIdOrString (de.be4.classicalb.core.parser.node.TPragmaIdOrString)2 VisitorException (de.be4.classicalb.core.parser.exceptions.VisitorException)1 AConstantsMachineClause (de.be4.classicalb.core.parser.node.AConstantsMachineClause)1 AEmptySetExpression (de.be4.classicalb.core.parser.node.AEmptySetExpression)1 AFreetypesMachineClause (de.be4.classicalb.core.parser.node.AFreetypesMachineClause)1 AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)1 AInitialisationMachineClause (de.be4.classicalb.core.parser.node.AInitialisationMachineClause)1 AInvariantMachineClause (de.be4.classicalb.core.parser.node.AInvariantMachineClause)1 AMachineMachineVariant (de.be4.classicalb.core.parser.node.AMachineMachineVariant)1 AMemberPredicate (de.be4.classicalb.core.parser.node.AMemberPredicate)1 AOperationsMachineClause (de.be4.classicalb.core.parser.node.AOperationsMachineClause)1 APowSubsetExpression (de.be4.classicalb.core.parser.node.APowSubsetExpression)1 EOF (de.be4.classicalb.core.parser.node.EOF)1 PMachineClause (de.be4.classicalb.core.parser.node.PMachineClause)1