Search in sources :

Example 1 with MultiLineCommentCharacters

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

the class SyntaxFacetFromESV method multiLineCommentCharacters.

private static Iterable<MultiLineCommentCharacters> multiLineCommentCharacters(IStrategoAppl document) {
    final Collection<MultiLineCommentCharacters> multiLineCommentCharacters = Lists.newLinkedList();
    final Iterable<IStrategoAppl> terms = ESVReader.collectTerms(document, "BlockCommentDef");
    for (IStrategoAppl term : terms) {
        final String prefix = ESVReader.termContents(term.getSubterm(0));
        final String postfix = ESVReader.termContents(term.getSubterm(2));
        multiLineCommentCharacters.add(new MultiLineCommentCharacters(prefix, postfix));
    }
    return multiLineCommentCharacters;
}
Also used : MultiLineCommentCharacters(org.metaborg.core.syntax.MultiLineCommentCharacters) IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl)

Example 2 with MultiLineCommentCharacters

use of org.metaborg.core.syntax.MultiLineCommentCharacters 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)

Aggregations

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