-
- public void endElement(String name, int line, int col) throws XML.SAXException {
-
- boolean hasNonWhitespace = false;
-
- int len = t == null || t.content == null ? 0 : t.content.length();
- for(int i=0; t.content != null && i<len; i++)
-
- // ignore double-slash comment blocks
- if (t.content.charAt(i) == '/' && t.content.charAt(i + 1) == '/') {
- while(t.content.charAt(i) != '\n' && i<len) i++;
- i--;
-
- // ignore /* .. */ comment blocks
- } else if (i<len - 1 && t.content.charAt(i) == '/' && t.content.charAt(i + 1) == '*') {
- i += 2;
- while(i<len - 1 && !(t.content.charAt(i) == '*' && t.content.charAt(i + 1) == '/')) i++;
- if (i<len - 1 && t.content.charAt(i) == '*' && t.content.charAt(i + 1) == '/') i += 2;
- i--;
-
- // check for named functions
- } else if (i + 8 <= len && t.content.charAt(i) == 'f' && t.content.charAt(i+1) == 'u' &&
- t.content.charAt(i+2) == 'n' && t.content.charAt(i+3) == 'c' && t.content.charAt(i+4) == 't' &&
- t.content.charAt(i+5) == 'i' && t.content.charAt(i+6) == 'o' && t.content.charAt(i+7) == 'n') {
- int j = i + 8;
- while(j<len && Character.isWhitespace(t.content.charAt(j))) j++;
- if (j<len && t.content.charAt(j) != '(')
- throw new XML.SAXException("named functions are not permitted in XWT -- instead of \"function foo() { ... }\"," +
- " use \"foo = function() { ... }\"");
-
- // replace " and " with " && "
- } else if (i + 5 < len && Character.isWhitespace(t.content.charAt(i)) &&
- t.content.charAt(i+1) == 'a' && t.content.charAt(i+2) == 'n' && t.content.charAt(i+3) == 'd' &&
- Character.isWhitespace(t.content.charAt(i + 4))) {
- t.content.setCharAt(i+1, '&');
- t.content.setCharAt(i+2, '&');
- t.content.setCharAt(i+3, ' ');
- hasNonWhitespace = true;
-
- // generic check for nonwhitespace
- } else if (!Character.isWhitespace(t.content.charAt(i))) {
- hasNonWhitespace = true;