From bf7be08e3b9ba79dc2f18928f5a922f33a3e595b Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 12 Jul 2011 18:10:52 +0400 Subject: [PATCH] Working on the Confluence highlighter --- .idea/ant.xml | 8 + .idea/compiler.xml | 3 + .idea/modules.xml | 1 + confluence/buildConfluenceLexer.xml | 46 + confluence/confluence.iml | 196 +++ confluence/pom.xml | 81 ++ .../src/main/java/com/intellij/lexer/Foo.java | 7 + .../main/java/com/intellij/psi/TokenType.java | 11 + .../com/intellij/psi/tree/IElementType.java | 7 + .../java/com/intellij/psi/tree/TokenSet.java | 24 + .../com/intellij/util/text/CharArrayUtil.java | 14 + .../org/jetbrains/jet/confluence/Jet.flex | 174 +++ .../org/jetbrains/jet/lexer/FlexLexer.java | 7 + .../jetbrains/jet/lexer/JetKeywordToken.java | 33 + .../org/jetbrains/jet/lexer/JetMacro.java | 74 + .../org/jetbrains/jet/lexer/JetToken.java | 12 + .../org/jetbrains/jet/lexer/JetTokens.java | 180 +++ .../org/jetbrains/jet/lexer/_JetLexer.java | 1204 +++++++++++++++++ .../src/main/resources/atlassian-plugin.xml | 15 + confluence/src/main/resources/jet.css | 8 + .../src/main/resources/template.velocity | 3 + 21 files changed, 2108 insertions(+) create mode 100644 confluence/buildConfluenceLexer.xml create mode 100644 confluence/confluence.iml create mode 100644 confluence/pom.xml create mode 100644 confluence/src/main/java/com/intellij/lexer/Foo.java create mode 100644 confluence/src/main/java/com/intellij/psi/TokenType.java create mode 100644 confluence/src/main/java/com/intellij/psi/tree/IElementType.java create mode 100644 confluence/src/main/java/com/intellij/psi/tree/TokenSet.java create mode 100644 confluence/src/main/java/com/intellij/util/text/CharArrayUtil.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/confluence/Jet.flex create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/FlexLexer.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/JetKeywordToken.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/JetMacro.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/JetToken.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/JetTokens.java create mode 100644 confluence/src/main/java/org/jetbrains/jet/lexer/_JetLexer.java create mode 100644 confluence/src/main/resources/atlassian-plugin.xml create mode 100644 confluence/src/main/resources/jet.css create mode 100644 confluence/src/main/resources/template.velocity diff --git a/.idea/ant.xml b/.idea/ant.xml index 902b2815260..82d39650097 100644 --- a/.idea/ant.xml +++ b/.idea/ant.xml @@ -18,6 +18,14 @@ + + + + + + + + diff --git a/.idea/compiler.xml b/.idea/compiler.xml index c3d5e3aea34..fb3e2a37c80 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -18,5 +18,8 @@ + + diff --git a/.idea/modules.xml b/.idea/modules.xml index 8958a9581db..d5e80fbc368 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,6 +3,7 @@ + diff --git a/confluence/buildConfluenceLexer.xml b/confluence/buildConfluenceLexer.xml new file mode 100644 index 00000000000..cc4c4742f1a --- /dev/null +++ b/confluence/buildConfluenceLexer.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/confluence/confluence.iml b/confluence/confluence.iml new file mode 100644 index 00000000000..fc5cac66650 --- /dev/null +++ b/confluence/confluence.iml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/confluence/pom.xml b/confluence/pom.xml new file mode 100644 index 00000000000..597e75b554a --- /dev/null +++ b/confluence/pom.xml @@ -0,0 +1,81 @@ + + + + + 4.0.0 + org.jetbrains.jet + confluence + 1.0 + + + JetBrains + http://www.jetbrains.com/ + + + confluence + Confluence support for Jet language. + atlassian-plugin + + + + junit + junit + 4.6 + test + + + com.atlassian.confluence + confluence + ${confluence.version} + provided + + + com.atlassian.confluence.plugin + func-test + 2.3 + test + + + net.sourceforge.jwebunit + jwebunit-htmlunit-plugin + 2.2 + test + + + net.sourceforge.nekohtml + nekohtml + 1.9.12 + test + + + + + + + com.atlassian.maven.plugins + maven-confluence-plugin + 3.3.4 + true + + ${confluence.version} + ${confluence.data.version} + + + + maven-compiler-plugin + + 1.6 + 1.6 + + + + + + + 3.5.2 + 3.5 + + + diff --git a/confluence/src/main/java/com/intellij/lexer/Foo.java b/confluence/src/main/java/com/intellij/lexer/Foo.java new file mode 100644 index 00000000000..44296740ce1 --- /dev/null +++ b/confluence/src/main/java/com/intellij/lexer/Foo.java @@ -0,0 +1,7 @@ +package com.intellij.lexer; + +/** + * @author abreslav + */ +public class Foo { +} diff --git a/confluence/src/main/java/com/intellij/psi/TokenType.java b/confluence/src/main/java/com/intellij/psi/TokenType.java new file mode 100644 index 00000000000..3e1f4783760 --- /dev/null +++ b/confluence/src/main/java/com/intellij/psi/TokenType.java @@ -0,0 +1,11 @@ +package com.intellij.psi; + +import com.intellij.psi.tree.IElementType; + +/** + * @author abreslav + */ +public class TokenType { + public static final IElementType WHITE_SPACE = new IElementType(); + public static final IElementType BAD_CHARACTER = new IElementType(); +} diff --git a/confluence/src/main/java/com/intellij/psi/tree/IElementType.java b/confluence/src/main/java/com/intellij/psi/tree/IElementType.java new file mode 100644 index 00000000000..f330cc75076 --- /dev/null +++ b/confluence/src/main/java/com/intellij/psi/tree/IElementType.java @@ -0,0 +1,7 @@ +package com.intellij.psi.tree; + +/** + * @author abreslav + */ +public class IElementType { +} diff --git a/confluence/src/main/java/com/intellij/psi/tree/TokenSet.java b/confluence/src/main/java/com/intellij/psi/tree/TokenSet.java new file mode 100644 index 00000000000..e60b90cf227 --- /dev/null +++ b/confluence/src/main/java/com/intellij/psi/tree/TokenSet.java @@ -0,0 +1,24 @@ +package com.intellij.psi.tree; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * @author abreslav + */ +public class TokenSet { + public static TokenSet create(IElementType... tokens) { + return new TokenSet(tokens); + } + + private final Set tokens = new HashSet(); + + public TokenSet(IElementType... tokens) { + this.tokens.addAll(Arrays.asList(tokens)); + } + + public Set asSet() { + return tokens; + } +} diff --git a/confluence/src/main/java/com/intellij/util/text/CharArrayUtil.java b/confluence/src/main/java/com/intellij/util/text/CharArrayUtil.java new file mode 100644 index 00000000000..9ae67a40627 --- /dev/null +++ b/confluence/src/main/java/com/intellij/util/text/CharArrayUtil.java @@ -0,0 +1,14 @@ +package com.intellij.util.text; + +/** + * @author abreslav + */ +public class CharArrayUtil { + public static char[] fromSequenceWithoutCopying(CharSequence buffer) { + char[] result = new char[buffer.length()]; + for (int i = 0; i < result.length; i++) { + result[i] = buffer.charAt(i); + } + return result; + } +} diff --git a/confluence/src/main/java/org/jetbrains/jet/confluence/Jet.flex b/confluence/src/main/java/org/jetbrains/jet/confluence/Jet.flex new file mode 100644 index 00000000000..ddb8978e4de --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/confluence/Jet.flex @@ -0,0 +1,174 @@ +/* It's an automatically generated code. Do not modify it. */ +package org.jetbrains.jet.confluence; + +import org.jetbrains.jet.confluence.JetTokens; + +%% + +%unicode +%class _JetLexer +%function advance +%type JetToken +%eof{ return; +%eof} + +DIGIT=[0-9] +HEX_DIGIT=[0-9A-Fa-f] +WHITE_SPACE_CHAR=[\ \t\f\r] + +// TODO: prohibit '$' in identifiers? +PLAIN_IDENTIFIER=[:jletter:] [:jletterdigit:]* +// TODO: this one MUST allow everything accepted by the runtime +// TODO: Replace backticks by one backslash in the begining +ESCAPED_IDENTIFIER = `{PLAIN_IDENTIFIER}` +IDENTIFIER = {PLAIN_IDENTIFIER}|{ESCAPED_IDENTIFIER} +FIELD_IDENTIFIER = \${IDENTIFIER} +LABEL_IDENTIFIER = \@{IDENTIFIER} + +BLOCK_COMMENT=("/*"[^"*"]{COMMENT_TAIL})|"/*" +// TODO: Wiki markup for doc comments? +DOC_COMMENT="/*""*"+("/"|([^"/""*"]{COMMENT_TAIL}))? +COMMENT_TAIL=([^"*"]*("*"+[^"*""/"])?)*("*"+"/")? +EOL_COMMENT="/""/"[^\n]* + +INTEGER_LITERAL={DECIMAL_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}|{BIN_INTEGER_LITERAL} +DECIMAL_INTEGER_LITERAL=(0|([1-9]({DIGIT})*)) +HEX_INTEGER_LITERAL=0[Xx]({HEX_DIGIT})* +BIN_INTEGER_LITERAL=0[Bb]({DIGIT})* +LONG_LITERAL=({INTEGER_LITERAL})[Ll] + +//FLOAT_LITERAL=(({FLOATING_POINT_LITERAL1})[Ff])|(({FLOATING_POINT_LITERAL2})[Ff])|(({FLOATING_POINT_LITERAL3})[Ff])|(({FLOATING_POINT_LITERAL4})[Ff]) +//DOUBLE_LITERAL=(({FLOATING_POINT_LITERAL1})[Dd]?)|(({FLOATING_POINT_LITERAL2})[Dd]?)|(({FLOATING_POINT_LITERAL3})[Dd]?)|(({FLOATING_POINT_LITERAL4})[Dd]) +DOUBLE_LITERAL={FLOATING_POINT_LITERAL1}|{FLOATING_POINT_LITERAL2}|{FLOATING_POINT_LITERAL3}|{FLOATING_POINT_LITERAL4} +FLOATING_POINT_LITERAL1=({DIGIT})+"."({DIGIT})+({EXPONENT_PART})? +FLOATING_POINT_LITERAL2="."({DIGIT})+({EXPONENT_PART})? +FLOATING_POINT_LITERAL3=({DIGIT})+({EXPONENT_PART}) +FLOATING_POINT_LITERAL4=({DIGIT})+ +EXPONENT_PART=[Ee]["+""-"]?({DIGIT})* +HEX_FLOAT_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Ff] +//HEX_DOUBLE_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}[Dd]? +HEX_DOUBLE_LITERAL={HEX_SIGNIFICAND}{BINARY_EXPONENT}? +BINARY_EXPONENT=[Pp][+-]?{DIGIT}+ +HEX_SIGNIFICAND={HEX_INTEGER_LITERAL}|0[Xx]{HEX_DIGIT}*\.{HEX_DIGIT}+ +//HEX_SIGNIFICAND={HEX_INTEGER_LITERAL}|{HEX_INTEGER_LITERAL}\.|0[Xx]{HEX_DIGIT}*\.{HEX_DIGIT}+ + +CHARACTER_LITERAL="'"([^\\\'\n]|{ESCAPE_SEQUENCE})*("'"|\\)? +// TODO: introduce symbols (e.g. 'foo) as another way to write string literals +STRING_LITERAL=\"([^\\\"\n]|{ESCAPE_SEQUENCE})*(\"|\\)? +ESCAPE_SEQUENCE=\\[^\n] + +// ANY_ESCAPE_SEQUENCE = \\[^] +THREE_QUO = (\"\"\") +ONE_TWO_QUO = (\"[^\"]) | (\"\"[^\"]) +QUO_STRING_CHAR = [^\"] | {ONE_TWO_QUO} +RAW_STRING_LITERAL = {THREE_QUO} {QUO_STRING_CHAR}* {THREE_QUO}? + +%% + + {BLOCK_COMMENT} { return JetTokens.BLOCK_COMMENT; } + {DOC_COMMENT} { return JetTokens.DOC_COMMENT; } + +\n {return JetTokens.WHITE_SPACE; } +({WHITE_SPACE_CHAR})+ { return JetTokens.WHITE_SPACE; } + + {EOL_COMMENT} { return JetTokens.EOL_COMMENT; } + + {INTEGER_LITERAL}\.\. { yypushback(2); return JetTokens.INTEGER_LITERAL; } + {INTEGER_LITERAL} { return JetTokens.INTEGER_LITERAL; } +// {LONG_LITERAL} { return JetTokens.LONG_LITERAL; } + +// {FLOAT_LITERAL} { return JetTokens.FLOAT_LITERAL; } +// {HEX_FLOAT_LITERAL} { return JetTokens.FLOAT_LITERAL; } + {DOUBLE_LITERAL} { return JetTokens.FLOAT_LITERAL; } + {HEX_DOUBLE_LITERAL} { return JetTokens.FLOAT_LITERAL; } + + {CHARACTER_LITERAL} { return JetTokens.CHARACTER_LITERAL; } + {STRING_LITERAL} { return JetTokens.STRING_LITERAL; } +// TODO: Decide what to do with """ ... """" + {RAW_STRING_LITERAL} { return JetTokens.RAW_STRING_LITERAL; } + + "namespace" { return JetTokens.NAMESPACE_KEYWORD ;} + "extension" { return JetTokens.EXTENSION_KEYWORD ;} + "continue" { return JetTokens.CONTINUE_KEYWORD ;} + "return" { return JetTokens.RETURN_KEYWORD ;} + "typeof" { return JetTokens.TYPEOF_KEYWORD ;} + "object" { return JetTokens.OBJECT_KEYWORD ;} + "while" { return JetTokens.WHILE_KEYWORD ;} + "break" { return JetTokens.BREAK_KEYWORD ;} + "class" { return JetTokens.CLASS_KEYWORD ;} + "throw" { return JetTokens.THROW_KEYWORD ;} + "false" { return JetTokens.FALSE_KEYWORD ;} + "when" { return JetTokens.WHEN_KEYWORD ;} + "true" { return JetTokens.TRUE_KEYWORD ;} + "type" { return JetTokens.TYPE_KEYWORD ;} + "this" { return JetTokens.THIS_KEYWORD ;} + "null" { return JetTokens.NULL_KEYWORD ;} + "else" { return JetTokens.ELSE_KEYWORD ;} + "This" { return JetTokens.CAPITALIZED_THIS_KEYWORD ;} + "try" { return JetTokens.TRY_KEYWORD ;} + "val" { return JetTokens.VAL_KEYWORD ;} + "var" { return JetTokens.VAR_KEYWORD ;} + "fun" { return JetTokens.FUN_KEYWORD ;} + "for" { return JetTokens.FOR_KEYWORD ;} +// "new" { return JetTokens.NEW_KEYWORD ;} + "is" { return JetTokens.IS_KEYWORD ;} + "in" { return JetTokens.IN_KEYWORD ;} + "if" { return JetTokens.IF_KEYWORD ;} + "do" { return JetTokens.DO_KEYWORD ;} + "as" { return JetTokens.AS_KEYWORD ;} + + {FIELD_IDENTIFIER} { return JetTokens.FIELD_IDENTIFIER; } + {IDENTIFIER} { return JetTokens.IDENTIFIER; } + {LABEL_IDENTIFIER} { return JetTokens.LABEL_IDENTIFIER; } + + "===" { return JetTokens.EQEQEQ ; } + "!==" { return JetTokens.EXCLEQEQEQ; } + "!in" { return JetTokens.NOT_IN; } + "!is" { return JetTokens.NOT_IS; } + "as?" { return JetTokens.AS_SAFE; } + "++" { return JetTokens.PLUSPLUS ; } + "--" { return JetTokens.MINUSMINUS; } + "<=" { return JetTokens.LTEQ ; } + ">=" { return JetTokens.GTEQ ; } + "==" { return JetTokens.EQEQ ; } + "!=" { return JetTokens.EXCLEQ ; } + "&&" { return JetTokens.ANDAND ; } + "||" { return JetTokens.OROR ; } + "?." { return JetTokens.SAFE_ACCESS;} + "?:" { return JetTokens.ELVIS ; } +// ".*" { return JetTokens.MAP ; } +// ".?" { return JetTokens.FILTER ; } + "*=" { return JetTokens.MULTEQ ; } + "/=" { return JetTokens.DIVEQ ; } + "%=" { return JetTokens.PERCEQ ; } + "+=" { return JetTokens.PLUSEQ ; } + "-=" { return JetTokens.MINUSEQ ; } + "->" { return JetTokens.ARROW ; } + "=>" { return JetTokens.DOUBLE_ARROW; } + ".." { return JetTokens.RANGE ; } + "@@" { return JetTokens.ATAT ; } + "[" { return JetTokens.LBRACKET ; } + "]" { return JetTokens.RBRACKET ; } + "{" { return JetTokens.LBRACE ; } + "}" { return JetTokens.RBRACE ; } + "(" { return JetTokens.LPAR ; } + ")" { return JetTokens.RPAR ; } + "." { return JetTokens.DOT ; } + "*" { return JetTokens.MUL ; } + "+" { return JetTokens.PLUS ; } + "-" { return JetTokens.MINUS ; } + "!" { return JetTokens.EXCL ; } + "/" { return JetTokens.DIV ; } + "%" { return JetTokens.PERC ; } + "<" { return JetTokens.LT ; } + ">" { return JetTokens.GT ; } + "?" { return JetTokens.QUEST ; } + ":" { return JetTokens.COLON ; } + ";" { return JetTokens.SEMICOLON ; } + "=" { return JetTokens.EQ ; } + "," { return JetTokens.COMMA ; } + "#" { return JetTokens.HASH ; } + "@" { return JetTokens.AT ; } + + . { return JetTokens.BAD_CHARACTER; } + diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/FlexLexer.java b/confluence/src/main/java/org/jetbrains/jet/lexer/FlexLexer.java new file mode 100644 index 00000000000..997cbe1454b --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/FlexLexer.java @@ -0,0 +1,7 @@ +package org.jetbrains.jet.lexer; + +/** + * @author abreslav + */ +public interface FlexLexer { +} diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/JetKeywordToken.java b/confluence/src/main/java/org/jetbrains/jet/lexer/JetKeywordToken.java new file mode 100644 index 00000000000..767bdb8c0b4 --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/JetKeywordToken.java @@ -0,0 +1,33 @@ +/* + * @author max + */ +package org.jetbrains.jet.lexer; + + +public class JetKeywordToken extends JetToken { + + public static JetKeywordToken keyword(String value) { + return new JetKeywordToken(value, false); + } + + public static JetKeywordToken softKeyword(String value) { + return new JetKeywordToken(value, true); + } + + private final String myValue; + private final boolean myIsSoft; + + private JetKeywordToken(String value, boolean isSoft) { + super(value); + myValue = value; + myIsSoft = isSoft; + } + + public String getValue() { + return myValue; + } + + public boolean isSoft() { + return myIsSoft; + } +} diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/JetMacro.java b/confluence/src/main/java/org/jetbrains/jet/lexer/JetMacro.java new file mode 100644 index 00000000000..124be8a0220 --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/JetMacro.java @@ -0,0 +1,74 @@ +package org.jetbrains.jet.lexer; + +import com.atlassian.confluence.renderer.radeox.macros.MacroUtils; +import com.atlassian.confluence.util.velocity.VelocityUtils; +import com.atlassian.renderer.RenderContext; +import com.atlassian.renderer.v2.RenderMode; +import com.atlassian.renderer.v2.macro.BaseMacro; +import com.atlassian.renderer.v2.macro.MacroException; +import com.intellij.psi.tree.IElementType; +import org.apache.velocity.VelocityContext; + +import java.io.IOException; +import java.io.StringReader; +import java.util.Map; + +/** + * @author abreslav + */ +public class JetMacro extends BaseMacro { + @Override + public boolean hasBody() { + return true; + } + + @Override + public RenderMode getBodyRenderMode() { + return RenderMode.allow(0); + } + + @Override + public String execute(Map map, String code, RenderContext renderContext) throws MacroException { + VelocityContext context = new VelocityContext(MacroUtils.defaultVelocityContext()); + String renderedTemplate = VelocityUtils.getRenderedTemplate("template.velocity", context); + + StringBuilder result = new StringBuilder(renderedTemplate); + result.append( + "
" + + "
" + + "
" + ); + + _JetLexer jetLexer = new _JetLexer(new StringReader(code)); + jetLexer.reset(code, 0, code.length(), _JetLexer.YYINITIAL); + while (true) { + try { + IElementType token = jetLexer.advance(); + if (token == null) break; + CharSequence yytext = jetLexer.yytext(); + String style; + if (token instanceof JetKeywordToken) { + style = "keyword"; + } else if (token == JetTokens.BLOCK_COMMENT || token == JetTokens.DOC_COMMENT || token == JetTokens.EOL_COMMENT) { + style = "comment"; + } else if (token == JetTokens.IDENTIFIER) { + + style = "softkeyword"; + } else if (token == JetTokens.WHITE_SPACE) { + style = "whitespace"; + } else { + style = "plain"; + } + result.append("").append(yytext).append(""); + + } catch (IOException e) { + result.append("ERROR IN HIGHLIGHTER: ").append(e.getClass().getSimpleName()).append(" : ").append(e.getMessage()); + } + } + + result.append("
"); + result.append("
"); + result.append("
"); + return result.toString(); + } +} diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/JetToken.java b/confluence/src/main/java/org/jetbrains/jet/lexer/JetToken.java new file mode 100644 index 00000000000..036df9b7001 --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/JetToken.java @@ -0,0 +1,12 @@ +/* + * @author max + */ +package org.jetbrains.jet.lexer; + + +import com.intellij.psi.tree.IElementType; + +public class JetToken extends IElementType { + public JetToken(String debugName) { + } +} diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/JetTokens.java b/confluence/src/main/java/org/jetbrains/jet/lexer/JetTokens.java new file mode 100644 index 00000000000..07b418207bf --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/JetTokens.java @@ -0,0 +1,180 @@ +/* + * @author max + */ +package org.jetbrains.jet.lexer; + +import com.intellij.psi.TokenType; +import com.intellij.psi.tree.IElementType; +import com.intellij.psi.tree.TokenSet; + +public interface JetTokens { + JetToken EOF = new JetToken("EOF"); + + JetToken BLOCK_COMMENT = new JetToken("BLOCK_COMMENT"); + JetToken DOC_COMMENT = new JetToken("DOC_COMMENT"); + JetToken EOL_COMMENT = new JetToken("EOL_COMMENT"); + + IElementType WHITE_SPACE = TokenType.WHITE_SPACE; + + JetToken INTEGER_LITERAL = new JetToken("INTEGER_LITERAL"); + JetToken LONG_LITERAL = new JetToken("LONG_LITERAL"); + JetToken FLOAT_LITERAL = new JetToken("FLOAT_CONSTANT"); + JetToken CHARACTER_LITERAL = new JetToken("CHARACTER_LITERAL"); +// JetToken STRING_LITERAL = new JetToken("STRING_LITERAL"); + + JetToken CLOSING_QUOTE = new JetToken("CLOSING_QUOTE"); + JetToken OPEN_QUOTE = new JetToken("OPEN_QUOTE"); + JetToken REGULAR_STRING_PART = new JetToken("REGULAR_STRING_PART"); + JetToken ESCAPE_SEQUENCE = new JetToken("ESCAPE_SEQUENCE"); + JetToken SHORT_TEMPLATE_ENTRY_START = new JetToken("SHORT_TEMPLATE_ENTRY_START"); + JetToken LONG_TEMPLATE_ENTRY_START = new JetToken("LONG_TEMPLATE_ENTRY_START"); + JetToken LONG_TEMPLATE_ENTRY_END = new JetToken("LONG_TEMPLATE_ENTRY_END"); + JetToken DANGLING_NEWLINE = new JetToken("DANGLING_NEWLINE"); + + JetToken RAW_STRING_LITERAL = new JetToken("RAW_STRING_LITERAL"); + + JetKeywordToken NAMESPACE_KEYWORD = JetKeywordToken.keyword("namespace"); + JetKeywordToken AS_KEYWORD = JetKeywordToken.keyword("as"); + JetKeywordToken TYPE_KEYWORD = JetKeywordToken.keyword("type"); + JetKeywordToken CLASS_KEYWORD = JetKeywordToken.keyword("class"); + JetKeywordToken THIS_KEYWORD = JetKeywordToken.keyword("this"); + JetKeywordToken VAL_KEYWORD = JetKeywordToken.keyword("val"); + JetKeywordToken VAR_KEYWORD = JetKeywordToken.keyword("var"); + JetKeywordToken FUN_KEYWORD = JetKeywordToken.keyword("fun"); + JetKeywordToken FOR_KEYWORD = JetKeywordToken.keyword("for"); + JetKeywordToken NULL_KEYWORD = JetKeywordToken.keyword("null"); + JetKeywordToken TRUE_KEYWORD = JetKeywordToken.keyword("true"); + JetKeywordToken FALSE_KEYWORD = JetKeywordToken.keyword("false"); + JetKeywordToken IS_KEYWORD = JetKeywordToken.keyword("is"); + JetKeywordToken IN_KEYWORD = JetKeywordToken.keyword("in"); + JetKeywordToken THROW_KEYWORD = JetKeywordToken.keyword("throw"); + JetKeywordToken RETURN_KEYWORD = JetKeywordToken.keyword("return"); + JetKeywordToken BREAK_KEYWORD = JetKeywordToken.keyword("break"); + JetKeywordToken CONTINUE_KEYWORD = JetKeywordToken.keyword("continue"); + JetKeywordToken OBJECT_KEYWORD = JetKeywordToken.keyword("object"); + JetKeywordToken IF_KEYWORD = JetKeywordToken.keyword("if"); + JetKeywordToken TRY_KEYWORD = JetKeywordToken.keyword("try"); + JetKeywordToken ELSE_KEYWORD = JetKeywordToken.keyword("else"); + JetKeywordToken WHILE_KEYWORD = JetKeywordToken.keyword("while"); + JetKeywordToken DO_KEYWORD = JetKeywordToken.keyword("do"); + JetKeywordToken WHEN_KEYWORD = JetKeywordToken.keyword("when"); + // TODO: Discuss "This" keyword + JetKeywordToken CAPITALIZED_THIS_KEYWORD = JetKeywordToken.keyword("This"); + + + JetToken AS_SAFE = new JetToken("as?"); + + JetToken IDENTIFIER = new JetToken("IDENTIFIER"); + JetToken LABEL_IDENTIFIER = new JetToken("LABEL_IDENTIFIER"); + + JetToken FIELD_IDENTIFIER = new JetToken("FIELD_IDENTIFIER"); + JetToken LBRACKET = new JetToken("LBRACKET"); + JetToken RBRACKET = new JetToken("RBRACKET"); + JetToken LBRACE = new JetToken("LBRACE"); + JetToken RBRACE = new JetToken("RBRACE"); + JetToken LPAR = new JetToken("LPAR"); + JetToken RPAR = new JetToken("RPAR"); + JetToken DOT = new JetToken("DOT"); + JetToken PLUSPLUS = new JetToken("PLUSPLUS"); + JetToken MINUSMINUS = new JetToken("MINUSMINUS"); + JetToken MUL = new JetToken("MUL"); + JetToken PLUS = new JetToken("PLUS"); + JetToken MINUS = new JetToken("MINUS"); + JetToken EXCL = new JetToken("EXCL"); + JetToken DIV = new JetToken("DIV"); + JetToken PERC = new JetToken("PERC"); + JetToken LT = new JetToken("LT"); + JetToken GT = new JetToken("GT"); + JetToken LTEQ = new JetToken("LTEQ"); + JetToken GTEQ = new JetToken("GTEQ"); + JetToken EQEQEQ = new JetToken("EQEQEQ"); + JetToken ARROW = new JetToken("ARROW"); + JetToken DOUBLE_ARROW = new JetToken("DOUBLE_ARROW"); + JetToken EXCLEQEQEQ = new JetToken("EXCLEQEQEQ"); + JetToken EQEQ = new JetToken("EQEQ"); + JetToken EXCLEQ = new JetToken("EXCLEQ"); + JetToken ANDAND = new JetToken("ANDAND"); + JetToken OROR = new JetToken("OROR"); + JetToken SAFE_ACCESS = new JetToken("SAFE_ACCESS"); + JetToken ELVIS = new JetToken("ELVIS"); + // JetToken MAP = new JetToken("MAP"); +// JetToken FILTER = new JetToken("FILTER"); + JetToken QUEST = new JetToken("QUEST"); + JetToken COLON = new JetToken("COLON"); + JetToken SEMICOLON = new JetToken("SEMICOLON"); + JetToken RANGE = new JetToken("RANGE"); + JetToken EQ = new JetToken("EQ"); + JetToken MULTEQ = new JetToken("MULTEQ"); + JetToken DIVEQ = new JetToken("DIVEQ"); + JetToken PERCEQ = new JetToken("PERCEQ"); + JetToken PLUSEQ = new JetToken("PLUSEQ"); + JetToken MINUSEQ = new JetToken("MINUSEQ"); + JetToken NOT_IN = JetKeywordToken.keyword("NOT_IN"); + JetToken NOT_IS = JetKeywordToken.keyword("NOT_IS"); + JetToken HASH = new JetToken("HASH"); + JetToken AT = new JetToken("AT"); + JetToken ATAT = new JetToken("ATAT"); + + TokenSet LABELS = TokenSet.create(AT, ATAT, LABEL_IDENTIFIER); + + JetToken COMMA = new JetToken("COMMA"); + + JetToken EOL_OR_SEMICOLON = new JetToken("EOL_OR_SEMICOLON"); + JetKeywordToken WRAPS_KEYWORD = JetKeywordToken.softKeyword("wraps"); + JetKeywordToken IMPORT_KEYWORD = JetKeywordToken.softKeyword("import"); + JetKeywordToken WHERE_KEYWORD = JetKeywordToken.softKeyword("where"); + JetKeywordToken BY_KEYWORD = JetKeywordToken.softKeyword("by"); + JetKeywordToken GET_KEYWORD = JetKeywordToken.softKeyword("get"); + JetKeywordToken SET_KEYWORD = JetKeywordToken.softKeyword("set"); + JetKeywordToken ABSTRACT_KEYWORD = JetKeywordToken.softKeyword("abstract"); + JetKeywordToken VIRTUAL_KEYWORD = JetKeywordToken.softKeyword("virtual"); + JetKeywordToken ENUM_KEYWORD = JetKeywordToken.softKeyword("enum"); + JetKeywordToken OPEN_KEYWORD = JetKeywordToken.softKeyword("open"); + JetKeywordToken ATTRIBUTE_KEYWORD = JetKeywordToken.softKeyword("attribute"); + JetKeywordToken OVERRIDE_KEYWORD = JetKeywordToken.softKeyword("override"); + JetKeywordToken PRIVATE_KEYWORD = JetKeywordToken.softKeyword("private"); + JetKeywordToken PUBLIC_KEYWORD = JetKeywordToken.softKeyword("public"); + JetKeywordToken INTERNAL_KEYWORD = JetKeywordToken.softKeyword("internal"); + JetKeywordToken PROTECTED_KEYWORD = JetKeywordToken.softKeyword("protected"); + JetKeywordToken CATCH_KEYWORD = JetKeywordToken.softKeyword("catch"); + JetKeywordToken OUT_KEYWORD = JetKeywordToken.softKeyword("out"); + + JetKeywordToken FINALLY_KEYWORD = JetKeywordToken.softKeyword("finally"); + + // TODO: support this as an annotation on arguments. Then, they it probably can not be a soft keyword + JetKeywordToken REF_KEYWORD = JetKeywordToken.softKeyword("ref"); + + TokenSet KEYWORDS = TokenSet.create(NAMESPACE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, CLASS_KEYWORD, + THIS_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, FUN_KEYWORD, FOR_KEYWORD, + NULL_KEYWORD, + TRUE_KEYWORD, FALSE_KEYWORD, IS_KEYWORD, + IN_KEYWORD, THROW_KEYWORD, RETURN_KEYWORD, BREAK_KEYWORD, CONTINUE_KEYWORD, OBJECT_KEYWORD, IF_KEYWORD, + ELSE_KEYWORD, WHILE_KEYWORD, DO_KEYWORD, TRY_KEYWORD, WHEN_KEYWORD, + NOT_IN, NOT_IS, CAPITALIZED_THIS_KEYWORD + ); + + TokenSet SOFT_KEYWORDS = TokenSet.create(WRAPS_KEYWORD, IMPORT_KEYWORD, WHERE_KEYWORD, BY_KEYWORD, GET_KEYWORD, + SET_KEYWORD, ABSTRACT_KEYWORD, VIRTUAL_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ATTRIBUTE_KEYWORD, + OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD, + CATCH_KEYWORD, FINALLY_KEYWORD, REF_KEYWORD, OUT_KEYWORD + ); + + TokenSet MODIFIER_KEYWORDS = TokenSet.create(ABSTRACT_KEYWORD, VIRTUAL_KEYWORD, ENUM_KEYWORD, + OPEN_KEYWORD, ATTRIBUTE_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, + PROTECTED_KEYWORD, REF_KEYWORD, OUT_KEYWORD, IN_KEYWORD + ); + TokenSet WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.create(WHITE_SPACE, BLOCK_COMMENT, EOL_COMMENT, DOC_COMMENT); + TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE); + TokenSet COMMENTS = TokenSet.create(EOL_COMMENT, BLOCK_COMMENT, DOC_COMMENT); + + TokenSet STRINGS = TokenSet.create(CHARACTER_LITERAL, REGULAR_STRING_PART, RAW_STRING_LITERAL); + TokenSet OPERATIONS = TokenSet.create(AS_KEYWORD, AS_SAFE, IS_KEYWORD, IN_KEYWORD, DOT, PLUSPLUS, MINUSMINUS, MUL, PLUS, + MINUS, EXCL, DIV, PERC, LT, GT, LTEQ, GTEQ, EQEQEQ, ARROW, EXCLEQEQEQ, EQEQ, EXCLEQ, ANDAND, OROR, + SAFE_ACCESS, ELVIS, +// MAP, FILTER, + QUEST, COLON, + RANGE, EQ, MULTEQ, DIVEQ, PERCEQ, PLUSEQ, MINUSEQ, + NOT_IN, NOT_IS, HASH, IDENTIFIER, LABEL_IDENTIFIER, ATAT, AT); + + TokenSet AUGMENTED_ASSIGNMENTS = TokenSet.create(PLUSEQ, MINUSEQ, MULTEQ, PERCEQ, DIVEQ); +} diff --git a/confluence/src/main/java/org/jetbrains/jet/lexer/_JetLexer.java b/confluence/src/main/java/org/jetbrains/jet/lexer/_JetLexer.java new file mode 100644 index 00000000000..9cd77cca9cc --- /dev/null +++ b/confluence/src/main/java/org/jetbrains/jet/lexer/_JetLexer.java @@ -0,0 +1,1204 @@ +/* The following code was generated by JFlex 1.4.3 on 7/12/11 5:50 PM */ + +/* It's an automatically generated code. Do not modify it. */ +package org.jetbrains.jet.lexer; + +import java.util.*; +import com.intellij.lexer.*; +import com.intellij.psi.*; +import com.intellij.psi.tree.IElementType; + +import org.jetbrains.jet.lexer.JetTokens; + + +/** + * This class is a scanner generated by + * JFlex 1.4.3 + * on 7/12/11 5:50 PM from the specification file + * /Users/abreslav/work/jet/confluence/../idea/src/org/jetbrains/jet/lexer/Jet.flex + */ +class _JetLexer implements FlexLexer { + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int STRING = 2; + public static final int YYINITIAL = 0; + public static final int LONG_TEMPLATE_ENTRY = 6; + public static final int SHORT_TEMPLATE_ENTRY = 4; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\3\1\13\1\0\1\3\23\0\1\3\1\60\1\25\1\77"+ + "\1\7\1\70\1\65\1\23\1\73\1\74\1\12\1\62\1\76\1\21"+ + "\1\17\1\11\1\14\11\1\1\67\1\75\1\63\1\57\1\64\1\61"+ + "\1\10\1\2\1\16\2\2\1\20\1\2\5\4\1\4\3\4\1\22"+ + "\3\4\1\54\3\4\1\15\2\4\1\71\1\24\1\72\1\0\1\4"+ + "\1\6\1\31\1\44\1\36\1\56\1\33\1\52\1\4\1\47\1\41"+ + "\1\45\1\51\1\50\1\32\1\30\1\37\1\35\1\4\1\43\1\34"+ + "\1\40\1\42\1\55\1\46\1\15\1\53\1\4\1\26\1\66\1\27"+ + "\54\0\1\4\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4"+ + "\1\0\u013f\4\31\0\162\4\4\0\14\4\16\0\5\4\11\0\1\4"+ + "\213\0\1\4\13\0\1\4\1\0\3\4\1\0\1\4\1\0\24\4"+ + "\1\0\54\4\1\0\46\4\1\0\5\4\4\0\202\4\10\0\105\4"+ + "\1\0\46\4\2\0\2\4\6\0\20\4\41\0\46\4\2\0\1\4"+ + "\7\0\47\4\110\0\33\4\5\0\3\4\56\0\32\4\5\0\13\4"+ + "\25\0\12\5\4\0\2\4\1\0\143\4\1\0\1\4\17\0\2\4"+ + "\7\0\2\4\12\5\3\4\2\0\1\4\20\0\1\4\1\0\36\4"+ + "\35\0\3\4\60\0\46\4\13\0\1\4\u0152\0\66\4\3\0\1\4"+ + "\22\0\1\4\7\0\12\4\4\0\12\5\25\0\10\4\2\0\2\4"+ + "\2\0\26\4\1\0\7\4\1\0\1\4\3\0\4\4\3\0\1\4"+ + "\36\0\2\4\1\0\3\4\4\0\12\5\2\4\23\0\6\4\4\0"+ + "\2\4\2\0\26\4\1\0\7\4\1\0\2\4\1\0\2\4\1\0"+ + "\2\4\37\0\4\4\1\0\1\4\7\0\12\5\2\0\3\4\20\0"+ + "\11\4\1\0\3\4\1\0\26\4\1\0\7\4\1\0\2\4\1\0"+ + "\5\4\3\0\1\4\22\0\1\4\17\0\2\4\4\0\12\5\25\0"+ + "\10\4\2\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4\1\0"+ + "\5\4\3\0\1\4\36\0\2\4\1\0\3\4\4\0\12\5\1\0"+ + "\1\4\21\0\1\4\1\0\6\4\3\0\3\4\1\0\4\4\3\0"+ + "\2\4\1\0\1\4\1\0\2\4\3\0\2\4\3\0\3\4\3\0"+ + "\10\4\1\0\3\4\55\0\11\5\25\0\10\4\1\0\3\4\1\0"+ + "\27\4\1\0\12\4\1\0\5\4\46\0\2\4\4\0\12\5\25\0"+ + "\10\4\1\0\3\4\1\0\27\4\1\0\12\4\1\0\5\4\3\0"+ + "\1\4\40\0\1\4\1\0\2\4\4\0\12\5\25\0\10\4\1\0"+ + "\3\4\1\0\27\4\1\0\20\4\46\0\2\4\4\0\12\5\25\0"+ + "\22\4\3\0\30\4\1\0\11\4\1\0\1\4\2\0\7\4\72\0"+ + "\60\4\1\0\2\4\14\0\7\4\11\0\12\5\47\0\2\4\1\0"+ + "\1\4\2\0\2\4\1\0\1\4\2\0\1\4\6\0\4\4\1\0"+ + "\7\4\1\0\3\4\1\0\1\4\1\0\1\4\2\0\2\4\1\0"+ + "\4\4\1\0\2\4\11\0\1\4\2\0\5\4\1\0\1\4\11\0"+ + "\12\5\2\0\2\4\42\0\1\4\37\0\12\5\26\0\10\4\1\0"+ + "\42\4\35\0\4\4\164\0\42\4\1\0\5\4\1\0\2\4\25\0"+ + "\12\5\6\0\6\4\112\0\46\4\12\0\51\4\7\0\132\4\5\0"+ + "\104\4\5\0\122\4\6\0\7\4\1\0\77\4\1\0\1\4\1\0"+ + "\4\4\2\0\7\4\1\0\1\4\1\0\4\4\2\0\47\4\1\0"+ + "\1\4\1\0\4\4\2\0\37\4\1\0\1\4\1\0\4\4\2\0"+ + "\7\4\1\0\1\4\1\0\4\4\2\0\7\4\1\0\7\4\1\0"+ + "\27\4\1\0\37\4\1\0\1\4\1\0\4\4\2\0\7\4\1\0"+ + "\47\4\1\0\23\4\16\0\11\5\56\0\125\4\14\0\u026c\4\2\0"+ + "\10\4\12\0\32\4\5\0\113\4\25\0\15\4\1\0\4\4\16\0"+ + "\22\4\16\0\22\4\16\0\15\4\1\0\3\4\17\0\64\4\43\0"+ + "\1\4\4\0\1\4\3\0\12\5\46\0\12\5\6\0\130\4\10\0"+ + "\51\4\127\0\35\4\51\0\12\5\36\4\2\0\5\4\u038b\0\154\4"+ + "\224\0\234\4\4\0\132\4\6\0\26\4\2\0\6\4\2\0\46\4"+ + "\2\0\6\4\2\0\10\4\1\0\1\4\1\0\1\4\1\0\1\4"+ + "\1\0\37\4\2\0\65\4\1\0\7\4\1\0\1\4\3\0\3\4"+ + "\1\0\7\4\3\0\4\4\2\0\6\4\4\0\15\4\5\0\3\4"+ + "\1\0\7\4\164\0\1\4\15\0\1\4\202\0\1\4\4\0\1\4"+ + "\2\0\12\4\1\0\1\4\3\0\5\4\6\0\1\4\1\0\1\4"+ + "\1\0\1\4\1\0\4\4\1\0\3\4\1\0\7\4\3\0\3\4"+ + "\5\0\5\4\u0ebb\0\2\4\52\0\5\4\5\0\2\4\4\0\126\4"+ + "\6\0\3\4\1\0\132\4\1\0\4\4\5\0\50\4\4\0\136\4"+ + "\21\0\30\4\70\0\20\4\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4"+ + "\u0773\0\u2ba4\4\u215c\0\u012e\4\2\0\73\4\225\0\7\4\14\0\5\4"+ + "\5\0\1\4\1\0\12\4\1\0\15\4\1\0\5\4\1\0\1\4"+ + "\1\0\2\4\1\0\2\4\1\0\154\4\41\0\u016b\4\22\0\100\4"+ + "\2\0\66\4\50\0\14\4\164\0\5\4\1\0\207\4\23\0\12\5"+ + "\7\0\32\4\6\0\32\4\13\0\131\4\3\0\6\4\2\0\6\4"+ + "\2\0\6\4\2\0\3\4\43\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\4\0\1\1\1\2\1\3\1\4\2\1\1\5\1\6"+ + "\1\7\1\2\1\10\1\11\1\12\1\13\1\14\1\15"+ + "\16\3\1\16\1\17\1\20\1\21\1\22\1\23\2\1"+ + "\1\24\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+ + "\1\34\2\35\1\36\1\0\1\37\1\40\1\0\1\41"+ + "\1\42\1\0\1\43\1\0\1\44\1\0\1\45\1\0"+ + "\1\46\1\47\1\50\1\51\1\52\1\43\2\2\1\43"+ + "\1\53\1\54\1\55\1\56\2\12\1\0\2\3\1\57"+ + "\7\3\1\60\1\61\1\62\10\3\1\63\1\64\1\65"+ + "\1\0\1\66\1\67\1\70\1\71\1\72\1\73\1\74"+ + "\1\75\1\76\1\77\1\100\1\0\1\101\1\102\1\0"+ + "\1\103\1\43\1\3\2\0\1\50\1\104\4\0\1\105"+ + "\2\3\1\106\5\3\1\107\10\3\1\110\1\111\1\3"+ + "\1\112\1\113\1\114\1\115\1\116\1\117\1\0\1\40"+ + "\1\44\1\45\1\0\2\104\1\43\2\0\1\3\1\120"+ + "\1\121\3\3\1\122\1\123\1\3\1\124\2\3\1\125"+ + "\2\3\1\126\1\100\1\50\2\0\2\3\1\127\1\3"+ + "\1\130\1\3\1\131\1\132\1\133\1\105\2\3\1\134"+ + "\1\135\3\3\1\136\1\137"; + + private static int [] zzUnpackAction() { + int [] result = new int[210]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\100\0\200\0\300\0\u0100\0\u0140\0\u0180\0\u01c0"+ + "\0\u0200\0\u0240\0\u0280\0\u02c0\0\u0300\0\u0340\0\u0380\0\u03c0"+ + "\0\u0400\0\u0440\0\u0100\0\u0100\0\u0480\0\u04c0\0\u0500\0\u0540"+ + "\0\u0580\0\u05c0\0\u0600\0\u0640\0\u0680\0\u06c0\0\u0700\0\u0740"+ + "\0\u0780\0\u07c0\0\u0800\0\u0840\0\u0880\0\u08c0\0\u0900\0\u0940"+ + "\0\u0980\0\u09c0\0\u0100\0\u0a00\0\u0100\0\u0100\0\u0100\0\u0100"+ + "\0\u0100\0\u0100\0\u0100\0\u0a40\0\u0a80\0\u0100\0\u0ac0\0\u0100"+ + "\0\u0b00\0\u0b40\0\u0100\0\u0100\0\u0b80\0\u0bc0\0\u0c00\0\u0c40"+ + "\0\u0c80\0\u0cc0\0\u0d00\0\u0100\0\u0d40\0\u0d80\0\u0100\0\u0100"+ + "\0\u0dc0\0\u0e00\0\u0e40\0\u0e80\0\u0100\0\u0100\0\u0100\0\u0100"+ + "\0\u0100\0\u0ec0\0\u0f00\0\u0f40\0\u0f80\0\u0fc0\0\u1000\0\u1040"+ + "\0\u1080\0\u10c0\0\u1100\0\u1140\0\u1180\0\u0180\0\u0180\0\u0180"+ + "\0\u11c0\0\u1200\0\u1240\0\u1280\0\u12c0\0\u1300\0\u1340\0\u1380"+ + "\0\u0180\0\u13c0\0\u0100\0\u1400\0\u1440\0\u0100\0\u0100\0\u0100"+ + "\0\u0100\0\u0100\0\u0100\0\u0100\0\u0100\0\u0100\0\u1480\0\u14c0"+ + "\0\u0100\0\u0100\0\u1500\0\u0100\0\u1540\0\u0100\0\u1580\0\u15c0"+ + "\0\u1600\0\u1640\0\u1680\0\u16c0\0\u1700\0\u1740\0\u1780\0\u17c0"+ + "\0\u1800\0\u0100\0\u1840\0\u1880\0\u18c0\0\u1900\0\u1940\0\u0180"+ + "\0\u1980\0\u19c0\0\u1a00\0\u1a40\0\u1a80\0\u1ac0\0\u1b00\0\u1b40"+ + "\0\u0180\0\u0180\0\u1b80\0\u0180\0\u0180\0\u0100\0\u0100\0\u0100"+ + "\0\u0100\0\u1bc0\0\u0100\0\u0100\0\u0100\0\u1c00\0\u1c40\0\u0100"+ + "\0\u1c80\0\u1540\0\u1cc0\0\u1d00\0\u0180\0\u0180\0\u1d40\0\u1d80"+ + "\0\u1dc0\0\u0180\0\u0180\0\u1e00\0\u0180\0\u1e40\0\u1e80\0\u0180"+ + "\0\u1ec0\0\u1f00\0\u0180\0\u0100\0\u0100\0\u1f40\0\u1f80\0\u1fc0"+ + "\0\u2000\0\u0180\0\u2040\0\u0180\0\u2080\0\u0180\0\u0180\0\u0180"+ + "\0\u0100\0\u20c0\0\u2100\0\u0180\0\u0180\0\u2140\0\u2180\0\u21c0"+ + "\0\u0180\0\u0180"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[210]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\5\1\6\1\7\1\10\1\7\1\5\1\11\1\12"+ + "\1\13\1\14\1\15\1\10\1\16\2\7\1\17\1\7"+ + "\1\20\1\7\1\21\1\5\1\22\1\23\1\24\1\25"+ + "\1\26\1\7\1\27\2\7\1\30\1\31\1\32\1\33"+ + "\1\7\1\34\1\35\1\7\1\36\3\7\1\37\1\7"+ + "\1\40\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+ + "\1\50\1\51\1\52\1\53\1\54\1\55\1\56\1\57"+ + "\1\60\1\61\1\62\1\63\7\64\1\65\3\64\1\66"+ + "\10\64\1\67\1\70\52\64\2\0\1\71\1\0\1\71"+ + "\1\0\1\72\6\0\2\71\1\0\1\71\1\0\1\71"+ + "\5\0\27\71\21\0\1\5\1\6\1\7\1\10\1\7"+ + "\1\5\1\11\1\12\1\13\1\14\1\15\1\10\1\16"+ + "\2\7\1\17\1\7\1\20\1\7\1\21\1\5\1\22"+ + "\1\73\1\74\1\25\1\26\1\7\1\27\2\7\1\30"+ + "\1\31\1\32\1\33\1\7\1\34\1\35\1\7\1\36"+ + "\3\7\1\37\1\7\1\40\1\41\1\42\1\43\1\44"+ + "\1\45\1\46\1\47\1\50\1\51\1\52\1\53\1\54"+ + "\1\55\1\56\1\57\1\60\1\61\1\62\1\63\101\0"+ + "\1\6\12\0\1\6\2\0\1\75\1\76\12\0\1\76"+ + "\45\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\27\7\24\0\1\10\7\0\1\10"+ + "\66\0\1\77\1\0\1\77\10\0\2\77\1\0\1\77"+ + "\1\0\1\77\5\0\27\77\23\0\1\100\1\0\1\100"+ + "\1\0\1\101\6\0\2\100\1\0\1\100\1\0\1\100"+ + "\5\0\27\100\23\0\1\102\1\0\1\102\1\0\1\103"+ + "\1\0\1\104\4\0\2\102\1\0\1\102\1\0\1\102"+ + "\5\0\27\102\32\0\1\105\1\106\44\0\1\107\77\0"+ + "\1\110\21\0\1\111\12\0\1\111\1\112\1\113\1\75"+ + "\1\76\12\0\1\76\10\0\1\113\34\0\1\114\12\0"+ + "\1\114\2\0\1\115\101\0\1\116\35\0\1\117\4\0"+ + "\1\120\13\0\13\21\1\0\7\21\1\121\1\122\53\21"+ + "\25\0\1\123\53\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\1\7\1\124\10\7"+ + "\1\125\14\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\4\7\1\126\22\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\20\7\1\127\6\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\7\7\1\130\10\7\1\131\6\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\14\7\1\132\12\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\13\7"+ + "\1\133\3\7\1\134\3\7\1\135\3\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\1\136\3\7\1\137\15\7\1\140\4\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\3\7\1\141\23\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\13\7\1\142\13\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\17\7\1\143"+ + "\7\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\1\7\1\144\5\7\1\145"+ + "\2\7\1\146\14\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\17\7\1\147"+ + "\7\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\1\7\1\150\25\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\7\7\1\151\17\7\100\0\1\152\4\0"+ + "\1\153\54\0\1\154\15\0\1\155\37\0\1\156\47\0"+ + "\1\157\67\0\1\160\2\0\1\161\74\0\1\162\77\0"+ + "\1\163\105\0\1\164\100\0\1\165\70\0\1\166\20\0"+ + "\7\64\1\0\3\64\1\0\10\64\2\0\52\64\2\0"+ + "\1\167\1\0\1\167\1\0\1\170\6\0\2\167\1\0"+ + "\1\167\1\0\1\167\3\0\1\171\1\0\27\167\21\0"+ + "\13\172\1\0\64\172\1\0\2\71\1\0\2\71\6\0"+ + "\3\71\1\0\1\71\1\0\1\71\5\0\27\71\23\0"+ + "\1\173\1\0\1\173\10\0\2\173\1\0\1\173\1\0"+ + "\1\173\5\0\27\173\22\0\1\114\12\0\1\114\2\0"+ + "\1\174\61\0\1\175\12\0\1\175\4\0\1\175\40\0"+ + "\1\175\16\0\2\77\1\0\2\77\1\176\5\0\3\77"+ + "\1\0\1\77\1\0\1\77\5\0\27\77\22\0\2\100"+ + "\1\0\2\100\6\0\3\100\1\0\1\100\1\0\1\100"+ + "\5\0\27\100\23\0\1\177\1\0\1\177\10\0\2\177"+ + "\1\0\1\177\1\0\1\177\5\0\27\177\22\0\2\102"+ + "\1\0\2\102\6\0\3\102\1\0\1\102\1\0\1\102"+ + "\5\0\27\102\23\0\1\200\1\0\1\200\10\0\2\200"+ + "\1\0\1\200\1\0\1\200\5\0\27\200\21\0\13\105"+ + "\1\0\64\105\12\201\1\202\65\201\1\0\1\111\12\0"+ + "\1\111\2\0\1\203\1\76\12\0\1\76\45\0\2\112"+ + "\11\0\1\112\1\0\1\112\1\204\1\112\1\0\1\205"+ + "\6\0\1\112\1\0\1\112\1\0\1\205\1\112\5\0"+ + "\1\112\5\0\1\112\3\0\1\112\22\0\1\113\12\0"+ + "\1\113\2\0\1\206\61\0\1\114\12\0\1\114\3\0"+ + "\1\76\12\0\1\76\44\0\13\21\1\0\64\21\25\0"+ + "\1\207\53\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\2\7\1\210\24\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\20\7\1\211\6\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\27\7\2\0\1\212\17\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\4\7\1\213"+ + "\22\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\1\214\26\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\1\7\1\215\25\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\15\7"+ + "\1\216\11\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\12\7\1\217\10\7"+ + "\1\220\3\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\11\7\1\221\1\7"+ + "\1\222\13\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\5\7\1\223\21\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\10\7\1\224\16\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\3\7\1\225\23\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\3\7"+ + "\1\226\5\7\1\227\15\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\20\7"+ + "\1\230\6\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\13\7\1\231\13\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\1\232\26\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\11\7\1\233\15\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\13\7\1\234"+ + "\4\7\1\235\6\7\100\0\1\236\50\0\1\237\3\0"+ + "\1\240\122\0\1\241\21\0\2\167\1\0\2\167\6\0"+ + "\3\167\1\0\1\167\1\0\1\167\5\0\27\167\23\0"+ + "\1\242\1\0\1\242\10\0\2\242\1\0\1\242\1\0"+ + "\1\242\5\0\27\242\22\0\2\173\1\0\2\173\1\243"+ + "\5\0\3\173\1\0\1\173\1\0\1\173\5\0\27\173"+ + "\22\0\1\175\12\0\1\175\64\0\2\177\1\0\2\177"+ + "\1\244\5\0\3\177\1\0\1\177\1\0\1\177\5\0"+ + "\27\177\22\0\2\200\1\0\2\200\1\245\5\0\3\200"+ + "\1\0\1\200\1\0\1\200\5\0\27\200\21\0\12\201"+ + "\1\246\65\201\11\247\1\250\1\202\65\247\1\0\1\114"+ + "\12\0\1\114\64\0\2\251\11\0\1\251\1\0\1\251"+ + "\1\174\1\251\10\0\1\251\1\0\1\251\2\0\1\251"+ + "\5\0\1\251\5\0\1\251\3\0\1\251\22\0\1\175"+ + "\12\0\1\175\4\0\1\252\40\0\1\252\34\0\1\174"+ + "\60\0\25\207\1\253\52\207\1\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\3\7"+ + "\1\254\23\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\20\7\1\255\6\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\3\7\1\256\23\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\10\7\1\257\16\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\4\7"+ + "\1\260\22\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\3\7\1\261\23\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\3\7\1\262\23\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\4\7\1\263\22\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\7\7"+ + "\1\264\17\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\3\7\1\265\23\7"+ + "\22\0\2\7\1\0\2\7\6\0\3\7\1\0\1\7"+ + "\1\0\1\7\5\0\12\7\1\266\14\7\22\0\2\7"+ + "\1\0\2\7\6\0\3\7\1\0\1\7\1\0\1\7"+ + "\5\0\1\7\1\267\25\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\1\270"+ + "\26\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\20\7\1\271\6\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\4\7\1\272\22\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\4\7\1\273\22\7\22\0\2\242\1\0\2\242\1\274"+ + "\5\0\3\242\1\0\1\242\1\0\1\242\5\0\27\242"+ + "\21\0\11\201\1\275\1\246\65\201\12\247\1\276\65\247"+ + "\1\0\2\251\11\0\1\251\1\0\1\251\1\0\1\251"+ + "\1\0\1\205\6\0\1\251\1\0\1\251\1\0\1\205"+ + "\1\251\5\0\1\251\5\0\1\251\3\0\1\251\21\0"+ + "\25\207\1\277\52\207\1\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\4\7\1\300"+ + "\22\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\11\7\1\301\15\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\4\7\1\302\22\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\6\7\1\303\20\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\16\7\1\304"+ + "\10\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\13\7\1\305\13\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\21\7\1\306\5\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\3\7\1\307\23\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\3\7\1\310"+ + "\23\7\21\0\11\247\1\250\1\276\65\247\25\207\1\311"+ + "\52\207\1\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\5\7\1\312\21\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\1\313\26\7\22\0\2\7\1\0\2\7"+ + "\6\0\3\7\1\0\1\7\1\0\1\7\5\0\10\7"+ + "\1\314\16\7\22\0\2\7\1\0\2\7\6\0\3\7"+ + "\1\0\1\7\1\0\1\7\5\0\1\315\26\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\1\7\1\316\25\7\22\0\2\7\1\0"+ + "\2\7\6\0\3\7\1\0\1\7\1\0\1\7\5\0"+ + "\12\7\1\317\14\7\22\0\2\7\1\0\2\7\6\0"+ + "\3\7\1\0\1\7\1\0\1\7\5\0\6\7\1\320"+ + "\20\7\22\0\2\7\1\0\2\7\6\0\3\7\1\0"+ + "\1\7\1\0\1\7\5\0\3\7\1\321\23\7\22\0"+ + "\2\7\1\0\2\7\6\0\3\7\1\0\1\7\1\0"+ + "\1\7\5\0\3\7\1\322\23\7\21\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[8704]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + private static final char[] EMPTY_BUFFER = new char[0]; + private static final int YYEOF = -1; + private static java.io.Reader zzReader = null; // Fake + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\4\0\1\11\15\1\2\11\26\1\1\11\1\1\7\11"+ + "\2\1\1\11\1\0\1\11\1\1\1\0\2\11\1\0"+ + "\1\1\1\0\1\1\1\0\1\1\1\0\1\11\2\1"+ + "\2\11\4\1\5\11\1\1\1\0\27\1\1\11\1\0"+ + "\1\1\11\11\1\1\1\0\2\11\1\0\1\11\1\1"+ + "\1\11\2\0\2\1\4\0\3\1\1\11\23\1\4\11"+ + "\1\0\3\11\1\0\1\1\1\11\1\1\2\0\20\1"+ + "\2\11\2\0\11\1\1\11\11\1"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[210]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private CharSequence zzBuffer = ""; + + /** this buffer may contains the current text array to be matched when it is cheap to acquire it */ + private char[] zzBufferArray; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the textposition at the last state to be included in yytext */ + private int zzPushbackPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + private static final class State { + final int lBraceCount; + final int state; + + public State(int state, int lBraceCount) { + this.state = state; + this.lBraceCount = lBraceCount; + } + } + + private final Stack states = new Stack(); + private int lBraceCount; + + private void pushState(int state) { + states.push(new State(yystate(), lBraceCount)); + lBraceCount = 0; + yybegin(state); + } + + private void popState() { + State state = states.pop(); + lBraceCount = state.lBraceCount; + yybegin(state.state); + } + + + _JetLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + _JetLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 1330) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + public final int getTokenStart(){ + return zzStartRead; + } + + public final int getTokenEnd(){ + return getTokenStart() + yylength(); + } + + public void reset(CharSequence buffer, int start, int end,int initialState){ + zzBuffer = buffer; + zzBufferArray = com.intellij.util.text.CharArrayUtil.fromSequenceWithoutCopying(buffer); + zzCurrentPos = zzMarkedPos = zzStartRead = start; + zzPushbackPos = 0; + zzAtEOF = false; + zzAtBOL = true; + zzEndRead = end; + yybegin(initialState); + } + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + return true; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final CharSequence yytext() { + return zzBuffer.subSequence(zzStartRead, zzMarkedPos); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBufferArray != null ? zzBufferArray[zzStartRead+pos]:zzBuffer.charAt(zzStartRead+pos); + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Contains user EOF-code, which will be executed exactly once, + * when the end of file is reached + */ + private void zzDoEOF() { + if (!zzEOFDone) { + zzEOFDone = true; + + } + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public IElementType advance() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + CharSequence zzBufferL = zzBuffer; + char[] zzBufferArrayL = zzBufferArray; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) + zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++); + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++); + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 3: + { return JetTokens.IDENTIFIER; + } + case 96: break; + case 11: + { pushState(STRING); return JetTokens.OPEN_QUOTE; + } + case 97: break; + case 72: + { return JetTokens.FOR_KEYWORD ; + } + case 98: break; + case 93: + { return JetTokens.RETURN_KEYWORD ; + } + case 99: break; + case 80: + { return JetTokens.NULL_KEYWORD ; + } + case 100: break; + case 34: + { if (lBraceCount == 0) { + popState(); + return JetTokens.LONG_TEMPLATE_ENTRY_END; + } + lBraceCount--; + return JetTokens.RBRACE; + } + case 101: break; + case 18: + { return JetTokens.LT ; + } + case 102: break; + case 51: + { return JetTokens.DO_KEYWORD ; + } + case 103: break; + case 17: + { return JetTokens.PLUS ; + } + case 104: break; + case 69: + { return JetTokens.RAW_STRING_LITERAL; + } + case 105: break; + case 57: + { return JetTokens.PLUSEQ ; + } + case 106: break; + case 27: + { return JetTokens.COMMA ; + } + case 107: break; + case 19: + { return JetTokens.GT ; + } + case 108: break; + case 4: + { return JetTokens.WHITE_SPACE; + } + case 109: break; + case 25: + { return JetTokens.RPAR ; + } + case 110: break; + case 53: + { return JetTokens.DOUBLE_ARROW; + } + case 111: break; + case 82: + { return JetTokens.TRUE_KEYWORD ; + } + case 112: break; + case 36: + { return JetTokens.FIELD_IDENTIFIER; + } + case 113: break; + case 61: + { return JetTokens.ANDAND ; + } + case 114: break; + case 65: + { pushState(LONG_TEMPLATE_ENTRY); return JetTokens.LONG_TEMPLATE_ENTRY_START; + } + case 115: break; + case 68: + { return JetTokens.DOC_COMMENT; + } + case 116: break; + case 35: + { return JetTokens.FLOAT_LITERAL; + } + case 117: break; + case 39: + { return JetTokens.EOL_COMMENT; + } + case 118: break; + case 85: + { return JetTokens.WHEN_KEYWORD ; + } + case 119: break; + case 20: + { return JetTokens.COLON ; + } + case 120: break; + case 59: + { return JetTokens.LTEQ ; + } + case 121: break; + case 46: + { return JetTokens.ARROW ; + } + case 122: break; + case 32: + { popState(); return JetTokens.IDENTIFIER; + } + case 123: break; + case 22: + { return JetTokens.LBRACKET ; + } + case 124: break; + case 67: + { yypushback(2); return JetTokens.INTEGER_LITERAL; + } + case 125: break; + case 10: + { return JetTokens.CHARACTER_LITERAL; + } + case 126: break; + case 74: + { return JetTokens.VAR_KEYWORD ; + } + case 127: break; + case 60: + { return JetTokens.GTEQ ; + } + case 128: break; + case 2: + { return JetTokens.INTEGER_LITERAL; + } + case 129: break; + case 13: + { return JetTokens.RBRACE ; + } + case 130: break; + case 87: + { return JetTokens.CLASS_KEYWORD ; + } + case 131: break; + case 15: + { return JetTokens.EXCL ; + } + case 132: break; + case 71: + { return JetTokens.TRY_KEYWORD ; + } + case 133: break; + case 54: + { return JetTokens.EXCLEQ ; + } + case 134: break; + case 45: + { return JetTokens.MINUSEQ ; + } + case 135: break; + case 88: + { return JetTokens.THROW_KEYWORD ; + } + case 136: break; + case 90: + { return JetTokens.WHILE_KEYWORD ; + } + case 137: break; + case 44: + { return JetTokens.MINUSMINUS; + } + case 138: break; + case 94: + { return JetTokens.CONTINUE_KEYWORD ; + } + case 139: break; + case 77: + { return JetTokens.NOT_IN; + } + case 140: break; + case 38: + { return JetTokens.ATAT ; + } + case 141: break; + case 6: + { return JetTokens.DIV ; + } + case 142: break; + case 56: + { return JetTokens.ELVIS ; + } + case 143: break; + case 37: + { return JetTokens.LABEL_IDENTIFIER; + } + case 144: break; + case 29: + { return JetTokens.REGULAR_STRING_PART; + } + case 145: break; + case 16: + { return JetTokens.QUEST ; + } + case 146: break; + case 62: + { return JetTokens.OROR ; + } + case 147: break; + case 21: + { return JetTokens.PERC ; + } + case 148: break; + case 79: + { return JetTokens.EXCLEQEQEQ; + } + case 149: break; + case 63: + { return JetTokens.PERCEQ ; + } + case 150: break; + case 43: + { return JetTokens.RANGE ; + } + case 151: break; + case 1: + { return TokenType.BAD_CHARACTER; + } + case 152: break; + case 55: + { return JetTokens.SAFE_ACCESS; + } + case 153: break; + case 95: + { return JetTokens.NAMESPACE_KEYWORD ; + } + case 154: break; + case 78: + { return JetTokens.NOT_IS; + } + case 155: break; + case 7: + { return JetTokens.MUL ; + } + case 156: break; + case 23: + { return JetTokens.RBRACKET ; + } + case 157: break; + case 58: + { return JetTokens.PLUSPLUS ; + } + case 158: break; + case 83: + { return JetTokens.THIS_KEYWORD ; + } + case 159: break; + case 8: + { return JetTokens.DOT ; + } + case 160: break; + case 26: + { return JetTokens.SEMICOLON ; + } + case 161: break; + case 50: + { return JetTokens.IF_KEYWORD ; + } + case 162: break; + case 66: + { return JetTokens.ESCAPE_SEQUENCE; + } + case 163: break; + case 31: + { popState(); return JetTokens.CLOSING_QUOTE; + } + case 164: break; + case 14: + { return JetTokens.EQ ; + } + case 165: break; + case 5: + { return JetTokens.AT ; + } + case 166: break; + case 70: + { return JetTokens.AS_SAFE; + } + case 167: break; + case 24: + { return JetTokens.LPAR ; + } + case 168: break; + case 9: + { return JetTokens.MINUS ; + } + case 169: break; + case 91: + { return JetTokens.FALSE_KEYWORD ; + } + case 170: break; + case 84: + { return JetTokens.TYPE_KEYWORD ; + } + case 171: break; + case 73: + { return JetTokens.FUN_KEYWORD ; + } + case 172: break; + case 49: + { return JetTokens.IS_KEYWORD ; + } + case 173: break; + case 30: + { popState(); yypushback(1); return JetTokens.DANGLING_NEWLINE; + } + case 174: break; + case 33: + { lBraceCount++; return JetTokens.LBRACE; + } + case 175: break; + case 41: + { return JetTokens.DIVEQ ; + } + case 176: break; + case 81: + { return JetTokens.ELSE_KEYWORD ; + } + case 177: break; + case 47: + { return JetTokens.AS_KEYWORD ; + } + case 178: break; + case 48: + { return JetTokens.IN_KEYWORD ; + } + case 179: break; + case 52: + { return JetTokens.EQEQ ; + } + case 180: break; + case 76: + { return JetTokens.EQEQEQ ; + } + case 181: break; + case 75: + { return JetTokens.VAL_KEYWORD ; + } + case 182: break; + case 86: + { return JetTokens.CAPITALIZED_THIS_KEYWORD ; + } + case 183: break; + case 42: + { return JetTokens.MULTEQ ; + } + case 184: break; + case 64: + { pushState(SHORT_TEMPLATE_ENTRY); + yypushback(yylength() - 1); + return JetTokens.SHORT_TEMPLATE_ENTRY_START; + } + case 185: break; + case 12: + { return JetTokens.LBRACE ; + } + case 186: break; + case 92: + { return JetTokens.OBJECT_KEYWORD ; + } + case 187: break; + case 89: + { return JetTokens.BREAK_KEYWORD ; + } + case 188: break; + case 40: + { return JetTokens.BLOCK_COMMENT; + } + case 189: break; + case 28: + { return JetTokens.HASH ; + } + case 190: break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + zzDoEOF(); + return null; + } + else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/confluence/src/main/resources/atlassian-plugin.xml b/confluence/src/main/resources/atlassian-plugin.xml new file mode 100644 index 00000000000..8a806b9d89b --- /dev/null +++ b/confluence/src/main/resources/atlassian-plugin.xml @@ -0,0 +1,15 @@ + + + ${project.description} + ${project.version} + + + + + Highlighting for Jet language + + + +      + + diff --git a/confluence/src/main/resources/jet.css b/confluence/src/main/resources/jet.css new file mode 100644 index 00000000000..48a99ba0d84 --- /dev/null +++ b/confluence/src/main/resources/jet.css @@ -0,0 +1,8 @@ +.jet { + white-space: pre; +} + +.jet.keyword { + font-weight: bold; + color: #369; +} \ No newline at end of file diff --git a/confluence/src/main/resources/template.velocity b/confluence/src/main/resources/template.velocity new file mode 100644 index 00000000000..8f0d70fe3cb --- /dev/null +++ b/confluence/src/main/resources/template.velocity @@ -0,0 +1,3 @@ + \ No newline at end of file