Search in sources :

Example 1 with FenceCharacters

use of org.metaborg.core.syntax.FenceCharacters in project spoofax by metaborg.

the class SyntaxFacetFromESV method create.

@Nullable
public static SyntaxFacet create(IStrategoAppl esv, FileObject location) throws FileSystemException {
    final String parseTableLocation = parseTableLocation(esv);
    final FileObject parseTable;
    if (parseTableLocation == null) {
        parseTable = null;
    } else {
        parseTable = location.resolveFile(parseTableLocation);
    }
    final FileObject completionParseTable = null;
    final Iterable<String> startSymbols = startSymbols(esv);
    final Iterable<String> singleLineCommentPrefixes = singleLineCommentPrefixes(esv);
    final Iterable<MultiLineCommentCharacters> multiLineCommentCharacters = multiLineCommentCharacters(esv);
    final Iterable<FenceCharacters> fenceCharacters = fenceCharacters(esv);
    final SyntaxFacet syntaxFacet = new SyntaxFacet(parseTable, completionParseTable, startSymbols, singleLineCommentPrefixes, multiLineCommentCharacters, fenceCharacters);
    return syntaxFacet;
}
Also used : MultiLineCommentCharacters(org.metaborg.core.syntax.MultiLineCommentCharacters) FileObject(org.apache.commons.vfs2.FileObject) FenceCharacters(org.metaborg.core.syntax.FenceCharacters) Nullable(javax.annotation.Nullable)

Example 2 with FenceCharacters

use of org.metaborg.core.syntax.FenceCharacters in project spoofax by metaborg.

the class SyntaxFacetFromESV method fenceCharacters.

private static Iterable<FenceCharacters> fenceCharacters(IStrategoAppl document) {
    final Collection<FenceCharacters> fenceCharacters = Lists.newLinkedList();
    final Iterable<IStrategoAppl> terms = ESVReader.collectTerms(document, "FenceDef");
    for (IStrategoAppl term : terms) {
        final String open = ESVReader.termContents(term.getSubterm(0));
        final String close = ESVReader.termContents(term.getSubterm(1));
        fenceCharacters.add(new FenceCharacters(open, close));
    }
    return fenceCharacters;
}
Also used : IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl) FenceCharacters(org.metaborg.core.syntax.FenceCharacters)

Aggregations

FenceCharacters (org.metaborg.core.syntax.FenceCharacters)2 Nullable (javax.annotation.Nullable)1 FileObject (org.apache.commons.vfs2.FileObject)1 MultiLineCommentCharacters (org.metaborg.core.syntax.MultiLineCommentCharacters)1 IStrategoAppl (org.spoofax.interpreter.terms.IStrategoAppl)1