Search in sources :

Example 36 with IStrategoAppl

use of org.spoofax.interpreter.terms.IStrategoAppl in project spoofax by metaborg.

the class SyntaxFacetFromESV method singleLineCommentPrefixes.

private static Iterable<String> singleLineCommentPrefixes(IStrategoAppl document) {
    final Collection<String> lineCommentPrefixes = Lists.newLinkedList();
    final Iterable<IStrategoAppl> terms = ESVReader.collectTerms(document, "LineCommentPrefix");
    for (IStrategoAppl term : terms) {
        lineCommentPrefixes.add(ESVReader.termContents(term.getSubterm(0)));
    }
    return lineCommentPrefixes;
}
Also used : IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl)

Example 37 with IStrategoAppl

use of org.spoofax.interpreter.terms.IStrategoAppl 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 38 with IStrategoAppl

use of org.spoofax.interpreter.terms.IStrategoAppl 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)

Example 39 with IStrategoAppl

use of org.spoofax.interpreter.terms.IStrategoAppl in project spoofax by metaborg.

the class SyntaxFacetFromESV method startSymbols.

private static Iterable<String> startSymbols(IStrategoAppl document) {
    final IStrategoAppl result = ESVReader.findTerm(document, "StartSymbols");
    if (result == null) {
        return null;
    }
    final String contents = ESVReader.termContents(termAt(termAt(result, 0), 0));
    return Iterables2.singleton(contents);
}
Also used : IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl)

Example 40 with IStrategoAppl

use of org.spoofax.interpreter.terms.IStrategoAppl in project spoofax by metaborg.

the class StylerFacetFromESV method style.

private static IStyle style(IStrategoAppl attribute) {
    final Color color = color((IStrategoAppl) attribute.getSubterm(0));
    final Color backgroundColor = color((IStrategoAppl) attribute.getSubterm(1));
    final boolean bold;
    final boolean italic;
    final boolean underline = false;
    final boolean strikeout = false;
    final IStrategoAppl fontSetting = (IStrategoAppl) attribute.getSubterm(2);
    final String fontSettingCons = fontSetting.getConstructor().getName();
    switch(fontSettingCons) {
        case "BOLD":
            bold = true;
            italic = false;
            break;
        case "ITALIC":
            bold = false;
            italic = true;
            break;
        case "BOLD_ITALIC":
            bold = true;
            italic = true;
            break;
        default:
            bold = false;
            italic = false;
            break;
    }
    return new Style(color, backgroundColor, bold, italic, underline, strikeout);
}
Also used : Color(java.awt.Color) IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl) IStyle(org.metaborg.core.style.IStyle) Style(org.metaborg.core.style.Style)

Aggregations

IStrategoAppl (org.spoofax.interpreter.terms.IStrategoAppl)42 IStrategoTerm (org.spoofax.interpreter.terms.IStrategoTerm)26 IStrategoString (org.spoofax.interpreter.terms.IStrategoString)21 ICompletion (org.metaborg.core.completion.ICompletion)13 Nullable (javax.annotation.Nullable)12 IStrategoList (org.spoofax.interpreter.terms.IStrategoList)9 ITermFactory (org.spoofax.interpreter.terms.ITermFactory)8 ListImploderAttachment (org.spoofax.jsglr.client.imploder.ListImploderAttachment)8 Completion (org.metaborg.core.completion.Completion)7 ITokens (org.spoofax.jsglr.client.imploder.ITokens)7 ImploderAttachment (org.spoofax.jsglr.client.imploder.ImploderAttachment)7 StrategoTerm (org.spoofax.terms.StrategoTerm)7 HybridInterpreter (org.strategoxt.HybridInterpreter)7 FileObject (org.apache.commons.vfs2.FileObject)6 MetaborgException (org.metaborg.core.MetaborgException)6 IStrategoTuple (org.spoofax.interpreter.terms.IStrategoTuple)6 CompletionKind (org.metaborg.core.completion.CompletionKind)5 StrategoAppl (org.spoofax.terms.StrategoAppl)5 IToken (org.spoofax.jsglr.client.imploder.IToken)4 ISourceRegion (org.metaborg.core.source.ISourceRegion)3