Examples of LangDef


Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

      AbstractSection _mainSection = file.getMainSection();
      final Document doc = ((Document) _mainSection);
      final EList<LangDef> defs = doc.getLangDefs();
      int _size = defs.size();
      Assert.assertEquals(1, _size);
      final LangDef def = IterableExtensions.<LangDef>head(defs);
      String _name = def.getName();
      Assert.assertEquals(name, _name);
      final EList<String> keywords = def.getKeywords();
      int _size_1 = expectedKeywords.size();
      int _size_2 = keywords.size();
      Assert.assertEquals(_size_1, _size_2);
      int _size_3 = keywords.size();
      int _minus = (_size_3 - 1);
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

 
  private CodeBlock testCodeBlock;
 
  @Before
  public void setUp() {
    LangDef _createLangDef = XdocFactory.eINSTANCE.createLangDef();
    this.testLangDef = _createLangDef;
    EList<String> _keywords = this.testLangDef.getKeywords();
    Iterables.<String>addAll(_keywords, ((Iterable<? extends String>)Conversions.doWrapArray(this.testKeyWords)));
    CodeBlock _createCodeBlock = XdocFactory.eINSTANCE.createCodeBlock();
    this.testCodeBlock = _createCodeBlock;
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

    final Utils utils = new Utils();
    String code = "";
    final StopWatch watch = new StopWatch();
    IntegerRange _upTo = new IntegerRange(0, 1);
    for (final Integer i : _upTo) {
      LangDef _langDef = this.langDef();
      String _formatCode = utils.formatCode("mein foo ist bar nicht baz.", _langDef);
      code = _formatCode;
    }
    watch.resetAndLog("keywords");
    Assert.assertEquals("mein&nbsp;<span class=\"keyword\">foo</span>&nbsp;ist&nbsp;<span class=\"keyword\">bar</span>&nbsp;nicht&nbsp;<span class=\"keyword\">baz</span>.", code);
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

  }
 
  @Test
  public void testFormatCode_01() {
    final Utils utils = new Utils();
    LangDef _langDef = this.langDef();
    final String code = utils.formatCode("/* mein foo ist bar nicht baz.*/", _langDef);
    Assert.assertEquals("<span class=\"comment\">/*&nbsp;mein&nbsp;foo&nbsp;ist&nbsp;bar&nbsp;nicht&nbsp;baz.*/</span>", code);
  }
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

  }
 
  @Test
  public void testFormatCode_02() {
    final Utils utils = new Utils();
    LangDef _langDef = this.langDef();
    final String code = utils.formatCode("\' mein foo ist bar nicht baz.\'", _langDef);
    Assert.assertEquals("<span class=\"string\">&apos;&nbsp;mein&nbsp;foo&nbsp;ist&nbsp;bar&nbsp;nicht&nbsp;baz.&apos;</span>", code);
  }
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

    Assert.assertEquals("<span class=\"string\">&apos;\\[mein\\]&apos;</span>", code);
  }
 
  public LangDef langDef() {
    final ArrayList<?> _cacheKey = CollectionLiterals.newArrayList();
    final LangDef _result;
    synchronized (_createCache_langDef) {
      if (_createCache_langDef.containsKey(_cacheKey)) {
        return _createCache_langDef.get(_cacheKey);
      }
      LangDef _createLangDef = XdocFactory.eINSTANCE.createLangDef();
      _result = _createLangDef;
      _createCache_langDef.put(_cacheKey, _result);
    }
    _init_langDef(_result);
    return _result;
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

  }
 
  private final HashMap<ArrayList<?>, LangDef> _createCache_langDef = CollectionLiterals.newHashMap();
 
  private void _init_langDef(final LangDef it) {
    LangDef _langDef = this.langDef();
    EList<String> _keywords = _langDef.getKeywords();
    ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList("foo", "bar", "baz", "dfsdf", "wweee", "dsfsd");
    Iterables.<String>addAll(_keywords, _newArrayList);
  }
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

    String d = DOC_HEAD + "codelanguage-def[" + name + "]["+ expectedKeywords[0] + "," + expectedKeywords[1] + " , " + expectedKeywords[2] +", " + expectedKeywords[3]+"]\n\nchapter[foo]\n\n";
    XdocFile file = getDoc(d);
    Document doc = (Document) file.getMainSection();
    List<LangDef> defs = doc.getLangDefs();
    assertEquals(1, defs.size());
    LangDef def = defs.get(0);
    assertEquals(name, def.getName());
    List<String> keywords = def.getKeywords();
    assertEquals(expectedKeywords.length, keywords.size());
    for (int i = 0; i < expectedKeywords.length; i++) {
      assertEquals(expectedKeywords[i], keywords.get(i));
    }
  }
View Full Code Here

Examples of org.eclipse.xtext.xdoc.xdoc.LangDef

  }

  static public final CodeBlock highlightCodeBlock(CodeBlock cb) {
    if (cb.getContents().size() > 0
        && cb.getContents().get(0) instanceof Code) {
      LangDef lang = cb.getLanguage();
      for (int i = 0; i < cb.getContents().size(); i++) {
        if (cb.getContents().get(i) instanceof Code) {
          String code = ((Code) cb.getContents().get(i))
              .getContents();
          Set<String> keywords = newHashSet();
          if (lang != null && !lang.eIsProxy()) {
            keywords.addAll(lang.getKeywords());
          }
          StringBuffer strBuffer = new StringBuffer();
          Common lexer = new Common();
          lexer.setCharStream(new ANTLRStringStream(code));
          CommonToken t = (CommonToken) lexer.nextToken();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.