diff --git a/.gitignore b/.gitignore index 6bc612f..1bce882 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /out/ /gen/ -src/com/zephir/lexer/ZephirLexer.java *~ *.jar diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml deleted file mode 100644 index f13b387..0000000 --- a/META-INF/plugin.xml +++ /dev/null @@ -1,59 +0,0 @@ - - com.zephir - Zephir - 0.2.4 - Zephir Team - - Zephir Language -

Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language that eases the creation and maintainability - of extensions for PHP. Zephir extensions are exported to C code that can be compiled and optimized by major C compilers - such as gcc/clang/vc++. Functionality is exposed to the PHP language.

- ]]>
- - 0.2.4: Added brace matching -
  • 0.2.3: Fixed build
  • -
  • 0.2.2: Improve highlighter, added color settings page
  • -
  • 0.2.1: Disabled "New Zephir class" dialog
  • -
  • 0.2.0: Added lexer and simple syntax highlighter
  • -
  • 0.1.0: Initial plugin
  • - ]]>
    - - - - - - com.intellij.modules.lang - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    diff --git a/README.md b/README.md index 6fee13e..897a21d 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,21 @@ Zephir IntelliJ IDEA plugin ========================== Plugin page: http://plugins.jetbrains.com/plugin/7558 + +`Start develop the Zephir plugin` + +1. Install next plugins for Intellij + +https://plugins.jetbrains.com/plugin/6606-grammar-kit +https://plugins.jetbrains.com/plugin/227-psiviewer + + +2. Go to Zephir.bnf file and run "Generate parser code" through context menu +3. Go to src/com/zephir/Zephir.flex and run "Run JFlex generator" through context menu + + +4. Run the plugin by Menu->Run->Run + +To automatically detect "Zephir plugin" in the debugged IDE, uncomment next lines in the `resources/META-INF/plugin.xml` + + \ No newline at end of file diff --git a/Zephir.iml b/Zephir.iml index 0e65b2b..2698cf2 100644 --- a/Zephir.iml +++ b/Zephir.iml @@ -1,16 +1,15 @@ - - + + - - + + - - + \ No newline at end of file diff --git a/lib/JFlex.jar b/lib/JFlex.jar deleted file mode 100644 index 8bef2fd..0000000 Binary files a/lib/JFlex.jar and /dev/null differ diff --git a/lib/idea-flex.skeleton b/lib/idea-flex.skeleton index 234a62c..b0854e9 100644 --- a/lib/idea-flex.skeleton +++ b/lib/idea-flex.skeleton @@ -1,3 +1,7 @@ + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + /** initial size of the lookahead buffer */ --- private static final int ZZ_BUFFERSIZE = ...; @@ -8,18 +12,18 @@ 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", + private static final String[] ZZ_ERROR_MSG = { + "Unknown fileTemplates scanner error", "Error: could not match input", "Error: pushback value was too large" }; --- isFinal list + /** the input device */ + private java.io.Reader zzReader; + /** the current state of the DFA */ private int zzState; @@ -30,15 +34,9 @@ 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; @@ -57,23 +55,24 @@ /** 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 class code --- constructor declaration - public final int getTokenStart(){ + public final int getTokenStart() { return zzStartRead; } - public final int getTokenEnd(){ + public final int getTokenEnd() { return getTokenStart() + yylength(); } - public void reset(CharSequence buffer, int start, int end,int initialState){ + 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; @@ -130,7 +129,7 @@ * @return the character at position pos */ public final char yycharat(int pos) { - return zzBufferArray != null ? zzBufferArray[zzStartRead+pos]:zzBuffer.charAt(zzStartRead+pos); + return zzBuffer.charAt(zzStartRead+pos); } @@ -202,8 +201,6 @@ int zzMarkedPosL; int zzEndReadL = zzEndRead; CharSequence zzBufferL = zzBuffer; - char[] zzBufferArrayL = zzBufferArray; - char [] zzCMapL = ZZ_CMAP; --- local declarations @@ -233,13 +230,13 @@ zzMarkedPos = zzMarkedPosL; --- char count update ---- actions - default: - if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { - zzAtEOF = true; + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; --- eofvalue - } - else { + } + else { +--- actions + default: --- no match } } diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml new file mode 100644 index 0000000..e8221c1 --- /dev/null +++ b/resources/META-INF/plugin.xml @@ -0,0 +1,62 @@ + + com.zephir + Zephir + 0.2.5 + Zephir Team + + Zephir Language +

    Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language that eases the creation and maintainability + of extensions for PHP. Zephir extensions are exported to C code that can be compiled and optimized by major C compilers + such as gcc/clang/vc++. Functionality is exposed to the PHP language.

    + ]]>
    + + 0.2.5: Fixed "switch" keyword detection +
  • 0.2.4: Added brace matching
  • +
  • 0.2.3: Fixed build
  • +
  • 0.2.2: Improve highlighter, added color settings page
  • +
  • 0.2.1: Disabled "New Zephir class" dialog
  • +
  • 0.2.0: Added lexer and simple syntax highlighter
  • +
  • 0.1.0: Initial plugin
  • + ]]>
    + + + + + + com.intellij.modules.lang + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/src/com/zephir/Zephir.bnf b/src/com/zephir/Zephir.bnf index 5a0e2c5..a5bc6f3 100644 --- a/src/com/zephir/Zephir.bnf +++ b/src/com/zephir/Zephir.bnf @@ -1,5 +1,6 @@ { parserClass="com.zephir.parser.ZephirParser" + parserUtilClass="com.zephir.parser.ZephirParserUtil" extends="com.intellij.extapi.psi.ASTWrapperPsiElement" @@ -11,6 +12,7 @@ elementTypeHolderClass="com.zephir.psi.ZephirTypes" elementTypeClass="com.zephir.psi.ZephirElementType" tokenTypeClass="com.zephir.psi.ZephirTokenType" + psiImplUtilClass="com.zephir.psi.impl.ZephirPsiImplUtil" tokens = [ // regex comment='regexp://.*' diff --git a/src/com/zephir/lexer/Zephir.flex b/src/com/zephir/lexer/Zephir.flex index 1fea9d4..692dd12 100644 --- a/src/com/zephir/lexer/Zephir.flex +++ b/src/com/zephir/lexer/Zephir.flex @@ -82,7 +82,7 @@ STRING = {DOUBLE_QUOTE} ( [^\"\\] | "\\" ( {DOUBLE_QUOTE} | {SINGLE_QUOTE} | {CO "if" { yybegin(YYINITIAL); return ZephirTypes.IF; } "else" { yybegin(YYINITIAL); return ZephirTypes.ELSE; } "elseif" { yybegin(YYINITIAL); return ZephirTypes.ELSEIF; } - "swith" { yybegin(YYINITIAL); return ZephirTypes.SWITCH; } + "switch" { yybegin(YYINITIAL); return ZephirTypes.SWITCH; } "case" { yybegin(YYINITIAL); return ZephirTypes.CASE; } "default" { yybegin(YYINITIAL); return ZephirTypes.DEFAULT; } "do" { yybegin(YYINITIAL); return ZephirTypes.DO; }