Search in sources :

Example 21 with TIdentifierLiteral

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

the class Utils method getTIdentifierListAsString.

public static String getTIdentifierListAsString(final List<TIdentifierLiteral> idElements) {
    final String string;
    if (idElements.size() == 1) {
        // faster version for the simple case
        string = idElements.get(0).getText();
    } else {
        final StringBuilder idName = new StringBuilder();
        boolean first = true;
        for (final TIdentifierLiteral e : idElements) {
            if (first) {
                first = false;
            } else {
                idName.append('.');
            }
            idName.append(e.getText());
        }
        string = idName.toString();
    }
    return string.trim();
}
Also used : TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral)

Example 22 with TIdentifierLiteral

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

the class Utils method getIdentifierAsString.

public static String getIdentifierAsString(final List<TIdentifierLiteral> idElements) {
    final StringBuilder idName = new StringBuilder();
    for (final TIdentifierLiteral e : idElements) {
        idName.append(e.getText());
        idName.append('.');
    }
    if (idElements.size() > 0) {
        idName.deleteCharAt(idName.length() - 1);
    }
    return idName.toString().trim();
}
Also used : TIdentifierLiteral(de.be4.eventbalg.core.parser.node.TIdentifierLiteral)

Example 23 with TIdentifierLiteral

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

the class Utils method getIdentifierAsString.

public static String getIdentifierAsString(final List<TIdentifierLiteral> idElements) {
    final StringBuilder idName = new StringBuilder();
    for (final TIdentifierLiteral e : idElements) {
        idName.append(e.getText());
        idName.append('.');
    }
    if (idElements.size() > 0) {
        idName.deleteCharAt(idName.length() - 1);
    }
    return idName.toString().trim();
}
Also used : TIdentifierLiteral(de.be4.eventb.core.parser.node.TIdentifierLiteral)

Example 24 with TIdentifierLiteral

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

the class PrimedIdentifierCheck method getIdentifier.

private static String getIdentifier(final LinkedList<TIdentifierLiteral> identifiers) {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (TIdentifierLiteral id : identifiers) {
        if (!first) {
            sb.append('.');
        }
        sb.append(id.getText().trim());
        first = false;
    }
    return sb.toString();
}
Also used : TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral)

Example 25 with TIdentifierLiteral

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

the class EBLexer method filter.

@Override
protected void filter() throws LexerException, IOException {
    super.filter();
    if (token != null && token instanceof TIdentifierLiteral && v.get(token.getText())) {
        Queue<IToken> ts = getNextList();
        List<IToken> toks = getTokenList();
        int l = token.getLine();
        int p = token.getPos();
        TLeftPar t1 = new TLeftPar(l, p);
        ts.add(t1);
        toks.add(t1);
        ts.add(token);
        toks.add(token);
        TEqual t2 = new TEqual("=", l, p);
        ts.add(t2);
        toks.add(t2);
        TTrue t3 = new TTrue("TRUE", l, p);
        ts.add(t3);
        toks.add(t3);
        TRightPar t4 = new TRightPar(l, p);
        ts.add(t4);
        toks.add(t4);
        token = null;
    }
}
Also used : IToken(de.hhu.stups.sablecc.patch.IToken) TTrue(de.be4.classicalb.core.parser.node.TTrue) TEqual(de.be4.classicalb.core.parser.node.TEqual) TRightPar(de.be4.classicalb.core.parser.node.TRightPar) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral) TLeftPar(de.be4.classicalb.core.parser.node.TLeftPar)

Aggregations

TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)44 ArrayList (java.util.ArrayList)23 AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)13 PExpression (de.be4.classicalb.core.parser.node.PExpression)9 CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)8 AExpressionDefinitionDefinition (de.be4.classicalb.core.parser.node.AExpressionDefinitionDefinition)8 ATotalFunctionExpression (de.be4.classicalb.core.parser.node.ATotalFunctionExpression)5 LinkedList (java.util.LinkedList)4 BException (de.be4.classicalb.core.parser.exceptions.BException)3 APowSubsetExpression (de.be4.classicalb.core.parser.node.APowSubsetExpression)3 AStringExpression (de.be4.classicalb.core.parser.node.AStringExpression)3 PSubstitution (de.be4.classicalb.core.parser.node.PSubstitution)3 TStringLiteral (de.be4.classicalb.core.parser.node.TStringLiteral)3 TIdentifierLiteral (de.be4.eventbalg.core.parser.node.TIdentifierLiteral)3 VisitorException (de.be4.classicalb.core.parser.exceptions.VisitorException)2 AConstructorFreetypeConstructor (de.be4.classicalb.core.parser.node.AConstructorFreetypeConstructor)2 ADefinitionExpression (de.be4.classicalb.core.parser.node.ADefinitionExpression)2 AEqualPredicate (de.be4.classicalb.core.parser.node.AEqualPredicate)2 AEvent (de.be4.classicalb.core.parser.node.AEvent)2 AEventBModelParseUnit (de.be4.classicalb.core.parser.node.AEventBModelParseUnit)2