Skip to content

Commit

Permalink
Version 0.7
Browse files Browse the repository at this point in the history
Annotates free strings to allow easy conversion to strings or variables.
Added <, <=, >, >= comparison operators with a warning if they are used in
SilverStripe versions lower than 3.1.
Added require tag.
Fixed fatal error in include refactor when a project is open without an open
file.
Change highlighting colors to align more with PHP.
Closes #31.
Closes #32.
Closes #33.
  • Loading branch information
MarcusDalgren committed Apr 10, 2013
1 parent cabac1c commit 96a444a
Show file tree
Hide file tree
Showing 19 changed files with 512 additions and 273 deletions.
47 changes: 32 additions & 15 deletions META-INF/plugin.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,10 @@
<idea-plugin version="2" url="https://github.com/raket/idea-silverstripe"> <idea-plugin version="2" url="https://github.com/raket/idea-silverstripe">
<id>com.raket.silverstripe</id> <id>com.raket.silverstripe</id>
<name>SilverStripe Template Language Support</name> <name>SilverStripe Template Language Support</name>
<version>0.6.1</version> <version>0.7</version>
<vendor logo="/icons/raket.png" email="marcus@raket.nu" url="https://github.com/raket/idea-silverstripe">Raket Webbyrå</vendor> <vendor logo="/icons/raket.png" email="marcus@raket.nu" url="https://github.com/raket/idea-silverstripe">Raket
Webbyrå
</vendor>


<description><![CDATA[ <description><![CDATA[
<a href="http://www.silverstripe.org/">SilverStripe</a> template language support<br> <a href="http://www.silverstripe.org/">SilverStripe</a> template language support<br>
Expand All @@ -13,26 +15,35 @@
<category>Custom Languages</category> <category>Custom Languages</category>
<change-notes> <change-notes>
<![CDATA[ <![CDATA[
<strong>Version 0.7</strong>
<ul>
<li><b>Features</b></li>
<li>Annotates free strings to allow easy conversion to strings or variables.</li>
<li>Added <, <=, >, >= comparison operators with a warning if they are used in SilverStripe versions lower than 3.1.</li>
<li>Added require tag.</li>
<li>Fixed fatal error in include refactor when a project is opened without an open file.</li>
<li>Change highlighting colors to align more with PHP.</li>
</ul>
<strong>Version 0.6.1</strong> <strong>Version 0.6.1</strong>
<ul> <ul>
<li><b>Features</b></li> <li><b>Features</b></li>
<li>Fixes reformat bug after removing text when refactoring to include file.</li> <li>Fixes reformat bug after removing text when refactoring to include file.</li>
<li>Correctly parses advanced versions of loop, with and control.</li> <li>Correctly parses advanced versions of loop, with and control.</li>
<li>"<" is no longer interpreted as a bad character</li> <li>"<" is no longer interpreted as a bad character.</li>
<li>Typing "{" should now consistently yield "{$}"</li> <li>Typing "{" should now consistently yield "{$}".</li>
</ul> </ul>
<strong>Version 0.6</strong> <strong>Version 0.6</strong>
<ul> <ul>
<li><b>Features</b></li> <li><b>Features</b></li>
<li>Refactor selected text to include file. This command moves the selected text to an include file. Defaults to ctrl+F6.</li> <li>Refactor selected text to include file. This command moves the selected text to an include file. Defaults to ctrl+F6.</li>
<li>Fix parser bug for else_if statements</li> <li>Fix parser bug for else_if statements.</li>
</ul> </ul>
<strong>Version 0.5.1</strong> <strong>Version 0.5.1</strong>
<ul> <ul>
<li><b>Features</b></li> <li><b>Features</b></li>
<li>Major bugfix that would freeze the lexer in some cases</li> <li>Major bugfix that would freeze the lexer in some cases.</li>
<li>Add YAML references for translations. It is now possible to ctrl+click an element in a yaml translation file to find the corresponding tag.</li> <li>Add YAML references for translations. It is now possible to ctrl+click an element in a yaml translation file to find the corresponding tag.</li>
<li>Gutter icon removed for include files</li> <li>Gutter icon removed for include files.</li>
</ul> </ul>
<strong>Version 0.5</strong> <strong>Version 0.5</strong>
<ul> <ul>
Expand Down Expand Up @@ -128,7 +139,8 @@
description="Add a new SilverStripe Template File"> description="Add a new SilverStripe Template File">
<add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewFile"/> <add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewFile"/>
</action> </action>
<action id="IncludeRefactor" class="com.raket.silverstripe.editor.actions.SilverStripeIncludeRefactorAction" text="Refactor to include file"> <action id="IncludeRefactor" class="com.raket.silverstripe.editor.actions.SilverStripeIncludeRefactorAction"
text="Refactor to include file">
<add-to-group group-id="IntroduceActionsGroup" anchor="last"/> <add-to-group group-id="IntroduceActionsGroup" anchor="last"/>
<keyboard-shortcut keymap="$default" first-keystroke="ctrl F6"/> <keyboard-shortcut keymap="$default" first-keystroke="ctrl F6"/>
</action> </action>
Expand Down Expand Up @@ -160,19 +172,24 @@
implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeIncludeAnnotator"/> implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeIncludeAnnotator"/>
<annotator language="SilverStripe" <annotator language="SilverStripe"
implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeTranslationAnnotator"/> implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeTranslationAnnotator"/>
<annotator language="SilverStripe"
implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeVariableAnnotator"/>
<annotator language="SilverStripe"
implementationClass="com.raket.silverstripe.editor.annotations.SilverStripeComparisonAnnotator"/>
<lang.commenter language="SilverStripe" <lang.commenter language="SilverStripe"
implementationClass="com.raket.silverstripe.editor.comments.SilverStripeCommenter"/> implementationClass="com.raket.silverstripe.editor.comments.SilverStripeCommenter"/>
<spellchecker.support language="SilverStripe" <spellchecker.support language="SilverStripe"
implementationClass="com.intellij.spellchecker.tokenizer.SpellcheckingStrategy"/> implementationClass="com.intellij.spellchecker.tokenizer.SpellcheckingStrategy"/>
<psi.referenceContributor <psi.referenceContributor
implementation="com.raket.silverstripe.references.SilverStripeReferenceContributor"/> implementation="com.raket.silverstripe.references.SilverStripeReferenceContributor"/>
<psi.referenceContributor <psi.referenceContributor
implementation="com.raket.silverstripe.references.SilverStripeYamlReferenceContributor"/> implementation="com.raket.silverstripe.references.SilverStripeYamlReferenceContributor"/>
<editorHighlighterProvider filetype="SilverStripe" implementationClass="com.raket.silverstripe.editor.highlighting.SilverStripeEditorHighlighterProvider"/> <editorHighlighterProvider filetype="SilverStripe"
<!-- implementationClass="com.raket.silverstripe.editor.highlighting.SilverStripeEditorHighlighterProvider"/>
<lang.syntaxHighlighterFactory key="SilverStripe" implementationClass="com.raket.silverstripe.editor.highlighting.SilverStripeSyntaxHighlighterFactory"/> <!--
<codeInsight.lineMarkerProvider language="SilverStripe" <lang.syntaxHighlighterFactory key="SilverStripe" implementationClass="com.raket.silverstripe.editor.highlighting.SilverStripeSyntaxHighlighterFactory"/>
implementationClass="com.raket.silverstripe.editor.lines.SilverStripeLineMarkerProvider"/> <codeInsight.lineMarkerProvider language="SilverStripe"
--> implementationClass="com.raket.silverstripe.editor.lines.SilverStripeLineMarkerProvider"/>
-->
</extensions> </extensions>
</idea-plugin> </idea-plugin>
Binary file modified idea-silverstripe.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions resources/messages/SilverStripeBundle.properties
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ ss.newfile.menu.action.description=Creates a new SilverStripe File
ss.annotations.file.not.found=Could not find include file "{0}". ss.annotations.file.not.found=Could not find include file "{0}".
ss.annotations.translation.no.identifier=Missing identifier in translation tag ss.annotations.translation.no.identifier=Missing identifier in translation tag
ss.annotations.translation.no.parameter.match=The parameters do not match up. Please add "{0}". ss.annotations.translation.no.parameter.match=The parameters do not match up. Please add "{0}".
ss.annotations.freestring.var=This variable is missing $. Either turn it into a string or add the $.
ss.annotations.comparison.not.supported=< and > operators are only supported in SilverStripe 3.1 and up.
13 changes: 8 additions & 5 deletions src/com/raket/silverstripe/SilverStripe.flex
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ SS_START_KEYWORD= loop | with | control
SS_IF_KEYWORD= if SS_IF_KEYWORD= if
SS_ELSE_IF_KEYWORD= else_if SS_ELSE_IF_KEYWORD= else_if
SS_ELSE_KEYWORD= else SS_ELSE_KEYWORD= else
SS_COMPARISON_OPERATOR= "==" | "!=" | "=" | "not" SS_COMPARISON_OPERATOR= "==" | "!=" | "=" | "not" | ">" | "<" | ">=" | "<="
SS_AND_OR_OPERATOR= "&&" | "||" SS_AND_OR_OPERATOR= "&&" | "||"
SS_STRING= \"[^\"]*\" | \'[^\']*\' SS_STRING= \"[^\"]*\" | \'[^\']*\'
SS_DOUBLE_WITH_VAR= [^\"{]* SS_DOUBLE_WITH_VAR= [^\"{]*
Expand Down Expand Up @@ -106,6 +106,7 @@ SS_TRANSLATION_IDENTIFIER= [a-zA-Z]+\.[a-zA-Z]+
%state SS_DOUBLE %state SS_DOUBLE
%state SS_SINGLE %state SS_SINGLE
%state SS_REQUIRE_CONTENT %state SS_REQUIRE_CONTENT
%state SS_IDENTIFIER
%% %%


<YYINITIAL> { <YYINITIAL> {
Expand Down Expand Up @@ -189,7 +190,6 @@ SS_TRANSLATION_IDENTIFIER= [a-zA-Z]+\.[a-zA-Z]+
{SS_COMPARISON_OPERATOR} { return SilverStripeTypes.SS_COMPARISON_OPERATOR; } {SS_COMPARISON_OPERATOR} { return SilverStripeTypes.SS_COMPARISON_OPERATOR; }
{SS_AND_OR_OPERATOR} { return SilverStripeTypes.SS_AND_OR_OPERATOR; } {SS_AND_OR_OPERATOR} { return SilverStripeTypes.SS_AND_OR_OPERATOR; }
{SS_STRING} { return SilverStripeTypes.SS_STRING; } {SS_STRING} { return SilverStripeTypes.SS_STRING; }
{NUMBER} { return SilverStripeTypes.NUMBER; }
{VAR} { yypushstate(SS_VAR); return SilverStripeTypes.SS_VAR; } {VAR} { yypushstate(SS_VAR); return SilverStripeTypes.SS_VAR; }
{SS_BLOCK_END} { yycleanstates(); return SilverStripeTypes.SS_BLOCK_END; } {SS_BLOCK_END} { yycleanstates(); return SilverStripeTypes.SS_BLOCK_END; }
} }
Expand Down Expand Up @@ -245,7 +245,7 @@ SS_TRANSLATION_IDENTIFIER= [a-zA-Z]+\.[a-zA-Z]+
{SS_VAR_START_DELIMITER} { return SilverStripeTypes.SS_VAR_START_DELIMITER; } {SS_VAR_START_DELIMITER} { return SilverStripeTypes.SS_VAR_START_DELIMITER; }
"$" { return SilverStripeTypes.SS_VAR_START; } "$" { return SilverStripeTypes.SS_VAR_START; }
{VAR} { return SilverStripeTypes.SS_VAR; } {VAR} { return SilverStripeTypes.SS_VAR; }
{DOT} { return SilverStripeTypes.DOT; } {DOT} { yypushstate(SS_IDENTIFIER); return SilverStripeTypes.DOT; }
{LEFT_PAREN} { yypushstate(SS_METHOD_ARGUMENTS); return SilverStripeTypes.LEFT_PAREN; } {LEFT_PAREN} { yypushstate(SS_METHOD_ARGUMENTS); return SilverStripeTypes.LEFT_PAREN; }


{SS_VAR_END_DELIMITER} { yypopstate(); return SilverStripeTypes.SS_VAR_END_DELIMITER; } {SS_VAR_END_DELIMITER} { yypopstate(); return SilverStripeTypes.SS_VAR_END_DELIMITER; }
Expand All @@ -256,14 +256,17 @@ SS_TRANSLATION_IDENTIFIER= [a-zA-Z]+\.[a-zA-Z]+
<SS_METHOD_ARGUMENTS> { <SS_METHOD_ARGUMENTS> {
{COMMA} { return SilverStripeTypes.COMMA; } {COMMA} { return SilverStripeTypes.COMMA; }
{VAR} { return SilverStripeTypes.SS_VAR; } {VAR} { return SilverStripeTypes.SS_VAR; }
{DOT} { return SilverStripeTypes.DOT; } {DOT} { yypushstate(SS_IDENTIFIER); return SilverStripeTypes.DOT; }
{SS_STRING} { return SilverStripeTypes.SS_STRING; } {SS_STRING} { return SilverStripeTypes.SS_STRING; }
{NUMBER} { return SilverStripeTypes.NUMBER; } {NUMBER} { return SilverStripeTypes.NUMBER; }
{RIGHT_PAREN} { yypopstate(); return SilverStripeTypes.RIGHT_PAREN; } {RIGHT_PAREN} { yypopstate(); return SilverStripeTypes.RIGHT_PAREN; }
{WHITE_SPACE}+ { return TokenType.WHITE_SPACE; } {WHITE_SPACE}+ { return TokenType.WHITE_SPACE; }
. { yypopstate(); yypushback(yylength()); } . { yypopstate(); yypushback(yylength()); }
} }

<SS_IDENTIFIER> {
[a-zA-Z_]+([a-zA-Z0-9_])* { yypopstate(); return SilverStripeTypes.SS_IDENTIFIER; }
. { yypopstate(); yypushback(yylength()); }
}
{WHITE_SPACE}+ { return TokenType.WHITE_SPACE; } {WHITE_SPACE}+ { return TokenType.WHITE_SPACE; }
{CRLF} {CRLF}
{ {
Expand Down
Loading

0 comments on commit 96a444a

Please sign in to comment.