public boolean isString(final Type type) {
   boolean _operator_and = false;
   boolean _operator_notEquals = ObjectExtensions.operator_notEquals(type, null);
   if (!_operator_notEquals) {
     _operator_and = false;
   } else {
     String _name = type.getName();
     boolean _operator_equals = ObjectExtensions.operator_equals(_name, "string");
     _operator_and = BooleanExtensions.operator_and(_operator_notEquals, _operator_equals);
   }
   return _operator_and;
 }
 public boolean isVoid(final Type type) {
   boolean _operator_or = false;
   boolean _operator_equals = ObjectExtensions.operator_equals(type, null);
   if (_operator_equals) {
     _operator_or = true;
   } else {
     String _name = type.getName();
     boolean _operator_equals_1 = ObjectExtensions.operator_equals(_name, "void");
     _operator_or = BooleanExtensions.operator_or(_operator_equals, _operator_equals_1);
   }
   return _operator_or;
 }
Exemple #3
0
 protected String trimCode(final String it) {
   String _xblockexpression = null;
   {
     int start = 0;
     boolean _operator_and = false;
     int _length = it.length();
     int _operator_minus = IntegerExtensions.operator_minus(_length, 1);
     boolean _operator_lessThan = IntegerExtensions.operator_lessThan(start, _operator_minus);
     if (!_operator_lessThan) {
       _operator_and = false;
     } else {
       boolean _operator_or = false;
       String _substring = it.substring(start, 1);
       boolean _operator_equals = ObjectExtensions.operator_equals(_substring, " ");
       if (_operator_equals) {
         _operator_or = true;
       } else {
         String _substring_1 = it.substring(start, 1);
         boolean _operator_equals_1 = ObjectExtensions.operator_equals(_substring_1, "\t");
         _operator_or = BooleanExtensions.operator_or(_operator_equals, _operator_equals_1);
       }
       _operator_and = BooleanExtensions.operator_and(_operator_lessThan, _operator_or);
     }
     boolean _while = _operator_and;
     while (_while) {
       int _operator_plus = IntegerExtensions.operator_plus(start, 1);
       start = _operator_plus;
       boolean _operator_and_1 = false;
       int _length_1 = it.length();
       int _operator_minus_1 = IntegerExtensions.operator_minus(_length_1, 1);
       boolean _operator_lessThan_1 =
           IntegerExtensions.operator_lessThan(start, _operator_minus_1);
       if (!_operator_lessThan_1) {
         _operator_and_1 = false;
       } else {
         boolean _operator_or_1 = false;
         String _substring_2 = it.substring(start, 1);
         boolean _operator_equals_2 = ObjectExtensions.operator_equals(_substring_2, " ");
         if (_operator_equals_2) {
           _operator_or_1 = true;
         } else {
           String _substring_3 = it.substring(start, 1);
           boolean _operator_equals_3 = ObjectExtensions.operator_equals(_substring_3, "\t");
           _operator_or_1 = BooleanExtensions.operator_or(_operator_equals_2, _operator_equals_3);
         }
         _operator_and_1 = BooleanExtensions.operator_and(_operator_lessThan_1, _operator_or_1);
       }
       _while = _operator_and_1;
     }
     String _substring_2 = it.substring(start, 1);
     boolean _operator_equals_2 = ObjectExtensions.operator_equals(_substring_2, "\n");
     if (_operator_equals_2) {
       int _operator_plus = IntegerExtensions.operator_plus(start, 1);
       start = _operator_plus;
     }
     int _length_1 = it.length();
     int _operator_minus_1 = IntegerExtensions.operator_minus(_length_1, 1);
     int end = _operator_minus_1;
     boolean _operator_and_1 = false;
     boolean _operator_greaterThan = IntegerExtensions.operator_greaterThan(end, 0);
     if (!_operator_greaterThan) {
       _operator_and_1 = false;
     } else {
       char _charAt = it.charAt(end);
       boolean _isWhitespace = Character.isWhitespace(_charAt);
       _operator_and_1 = BooleanExtensions.operator_and(_operator_greaterThan, _isWhitespace);
     }
     boolean _while_1 = _operator_and_1;
     while (_while_1) {
       int _operator_minus_2 = IntegerExtensions.operator_minus(end, 1);
       end = _operator_minus_2;
       boolean _operator_and_2 = false;
       boolean _operator_greaterThan_1 = IntegerExtensions.operator_greaterThan(end, 0);
       if (!_operator_greaterThan_1) {
         _operator_and_2 = false;
       } else {
         char _charAt_1 = it.charAt(end);
         boolean _isWhitespace_1 = Character.isWhitespace(_charAt_1);
         _operator_and_2 =
             BooleanExtensions.operator_and(_operator_greaterThan_1, _isWhitespace_1);
       }
       _while_1 = _operator_and_2;
     }
     int _operator_plus_1 = IntegerExtensions.operator_plus(end, 1);
     String _substring_3 = it.substring(start, _operator_plus_1);
     _xblockexpression = (_substring_3);
   }
   return _xblockexpression;
 }
Exemple #4
0
 protected CharSequence internalToHtml(final CodeBlock it, final boolean isParagraph) {
   CharSequence _xblockexpression = null;
   {
     EList<EObject> _contents = it.getContents();
     CharSequence _html = this.toHtml(_contents);
     String _string = _html.toString();
     final String code = _string;
     String _xifexpression = null;
     LangDef _language = it.getLanguage();
     String _name = _language == null ? (String) null : _language.getName();
     boolean _operator_equals = ObjectExtensions.operator_equals(_name, null);
     if (_operator_equals) {
       _xifexpression = "xtend";
     } else {
       LangDef _language_1 = it.getLanguage();
       String _name_1 = _language_1.getName();
       _xifexpression = _name_1;
     }
     final String languageName = _xifexpression;
     CharSequence _xifexpression_1 = null;
     boolean _operator_or = false;
     boolean _contains = code.contains("\n");
     if (_contains) {
       _operator_or = true;
     } else {
       boolean _contains_1 = code.contains("\r");
       _operator_or = BooleanExtensions.operator_or(_contains, _contains_1);
     }
     if (_operator_or) {
       StringConcatenation _builder = new StringConcatenation();
       {
         if (isParagraph) {
           _builder.append("</p>");
         }
       }
       _builder.append("<pre class=\"prettyprint lang-");
       String _lowerCase = languageName.toLowerCase();
       _builder.append(_lowerCase, "");
       _builder.append("\">");
       String _markCodeBegin = this.markCodeBegin();
       _builder.append(_markCodeBegin, "");
       _builder.newLineIfNotEmpty();
       String _trimCode = this.trimCode(code);
       _builder.append(_trimCode, "");
       String _markCodeEnd = this.markCodeEnd();
       _builder.append(_markCodeEnd, "");
       _builder.append("</pre>");
       {
         if (isParagraph) {
           _builder.append("<p>");
         }
       }
       _builder.newLineIfNotEmpty();
       _xifexpression_1 = _builder;
     } else {
       StringConcatenation _builder_1 = new StringConcatenation();
       _builder_1.append("<code class=\"prettyprint lang-");
       String _lowerCase_1 = languageName.toLowerCase();
       _builder_1.append(_lowerCase_1, "");
       _builder_1.append("\">");
       String _trimCode_1 = this.trimCode(code);
       _builder_1.append(_trimCode_1, "");
       _builder_1.append("</code>");
       _xifexpression_1 = _builder_1;
     }
     _xblockexpression = (_xifexpression_1);
   }
   return _xblockexpression;
 }