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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations