Update GNU GetText plugin

This commit is contained in:
Svetlana.Zemlyanskay
2012-07-11 17:05:59 +04:00
parent 1cbe993c1e
commit ade996a85b
43 changed files with 702 additions and 508 deletions
+4 -13
View File
@@ -13,20 +13,11 @@
<extensions defaultExtensionNs="com.intellij">
<fileTypeFactory implementation="com.jetbrains.gettext.GetTextFileTypeFactory"/>
<syntaxHighlighter key="GetText" implementationClass="com.jetbrains.gettext.highlighter.GetTextSyntaxHighlighter"/>
<!--<colorSettingsPage implementation="com.jetbrains.typoscript.lang.highlighter.TypoScriptColorsAndFontsPage"/>-->
<lang.parserDefinition language="GetText" implementationClass="com.jetbrains.gettext.parser.GetTextParserDefinition"/>
<!--<lang.braceMatcher language="TypoScript" implementationClass="com.jetbrains.typoscript.lang.TypoScriptBraceMatcher"/>-->
<!--<lang.foldingBuilder language="TypoScript" implementationClass="com.jetbrains.typoscript.lang.TypoScriptFoldingBuilder"/>-->
<!--<lang.psiStructureViewFactory language="TypoScript" implementationClass="com.jetbrains.typoscript.lang.TypoScriptStructureViewFactory"/>-->
<!--<lang.fileViewProviderFactory language="GetText"-->
<!--implementationClass="com.jetbrains.gettext.GetTextFileViewProviderFactory"/>-->
<!--<completion.contributor language="GetText" implementationClass="com.jetbrains.gettext.completion.GetTextCompletitionContributor"/>-->
<lang.commenter language="GetText" implementationClass="com.jetbrains.gettext.completion.GetTextCommenter"/>
<quoteHandler fileType="GetText" className="com.jetbrains.gettext.completion.GetTextQuoteHandler"/>
<lang.braceMatcher language="GetText" implementationClass="com.jetbrains.gettext.completion.GetTextBraceMatcher"/>
<completion.contributor language="GetText" implementationClass="com.jetbrains.gettext.completion.GetTextCompletionContributor"/>
</extensions>
</idea-plugin>
@@ -26,35 +26,26 @@ import com.jetbrains.gettext.GetTextElementType;
%ignorecase
EOL = (\r|\n|\r\n)
NO_EOL = !(\r|\n|\r\n)
SPACE = [ \t\f]
WHITE_SPACE = {EOL} | {SPACE}
STRING_TAIL = [^\r\n]*
QUOTED_STRING = ("\"")~(\r|\n|\r\n|"\"")
TMP_QUOTED_STRING = ("\"")~("\"")
DOUBLEQUOTE = \"
DOUBLEQUOTED_STRING = ([^\"] | \"\" | \\\")+
LBRACE = "["
RBRACE = "]"
NUMBER = [0-9]*
LETTERS = [a-zA-Z]*
COMMENT_SYMBOL = "#"
COMMENT_TYPE_SYMBOLS = ("#."|"#:"|"#,"|"#|")
COMMENT = (" "|\t|\f)~{EOL}
EXTRACTED_COMMENT = (".")~{EOL}
REFERENCE_COMMENT = (":")~{EOL}
PREVIOUS_COMMENT = ("|")~{EOL}
EXTRACTED_COMMENT = ("."){STRING_TAIL}
REFERENCE_COMMENT = (":"){STRING_TAIL}
PREVIOUS_COMMENT = ("|"){STRING_TAIL}
FLAG_GROUP = (",")
DOT = "."
COLON = ":"
LINE = "|"
COMMA = ","
MSGCTXT = "msgctxt"
MSGID = "msgid"
MSGID_PLURAL = "msgid_plural"
@@ -62,43 +53,17 @@ MSGSTR = "msgstr"
FUZZY_FLAG = "fuzzy"
NO = "no-"
FORMAT = "-format"
C = "c"
OBJC = "objc"
SH = "sh"
PYTHON = "python"
LISP = "lisp"
ELISP = "elisp"
LIBREP = "librep"
SCHEME = "scheme"
SMALLTALK = "smalltalk"
JAVA = "java"
CSHARP = "csharp"
AWK = "awk"
YCP = "ycp"
TCL = "tcl"
PERL = "perl-brace"
PHP = "php"
GCC = "gcc-internal"
GFC = "gfc-internal"
QT = "qt"
KDE = "kde"
BOOST = "boost"
OBJECT_PASCAL = "object-pascal"
QT_PLURAL = "qt-plural"
PASCAL_FORMAT_FLAG = "object-pascal-format"
NO_PASCAL_FORMAT_FLAG = "no-object-pascal-format"
QT_FORMAT_FLAG = "qt-plural-format"
NO_QT_FORMAT_FLAG = "no-qt-plural-format"
FORMAT_FLAG = (C|OBJC|SH|PYTHON|LISP|EISP|LIBREP|SCHEME|SMALLTALK|JAVA|SCHARP|AWK|OBJECT_PASCAL|YCP|TCL|PERL|PHP|GCC|GFC|QT|QT_PLURAL|KDE|BOOST) {FORMAT}
NO = "no-"
FORMAT_FLAG = ("c"|"objc"|"sh"|"python"|"lisp"|"elisp"|"librep"|"scheme"|"smalltalk"|"java"|
"csharp"|"awk"|"object-pascal"|"ycp"|"tcl"|"perl-brace"|"php"|"gcc-internal"|"gfc-internal"|
"qt"|"qt-plural"|"kde"|"boost") {FORMAT}
NO_FORMAT_FLAG = {NO} {FORMAT_FLAG}
RANGE_FLAG = "range"
DOTS = ".."
FLAG_DELIVERY=","
COLON = ":"
%state START_COMMENT
%state COMMENT
@@ -114,10 +79,10 @@ FLAG_DELIVERY=","
<YYINITIAL> {COMMENT_SYMBOL} { yybegin(START_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {SPACE} { yybegin(COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {DOT} { yybegin(EXTR_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {COLON} { yybegin(REFERENCE_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {LINE} { yybegin(PREVIOUS_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {FLAG_GROUP} { yybegin(FLAG_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;}
<START_COMMENT> {EXTRACTED_COMMENT} { yybegin(EXTR_COMMENT); return GetTextTokenTypes.EXTR_COMMENT;}
<START_COMMENT> {REFERENCE_COMMENT} { yybegin(REFERENCE_COMMENT); return GetTextTokenTypes.REFERENCE;}
<START_COMMENT> {PREVIOUS_COMMENT} { yybegin(PREVIOUS_COMMENT); return GetTextTokenTypes.PREVIOUS_COMMENT;}
<START_COMMENT> {FLAG_GROUP} { yybegin(FLAG_COMMENT); return GetTextTokenTypes.FLAG_COMMENT;}
<START_COMMENT> {EOL} { yybegin(YYINITIAL); return GetTextTokenTypes.WHITE_SPACE;}
<COMMENT> {EOL} { yybegin(YYINITIAL); return GetTextTokenTypes.WHITE_SPACE;}
@@ -132,29 +97,31 @@ FLAG_DELIVERY=","
<REFERENCE_COMMENT> {STRING_TAIL} { return GetTextTokenTypes.REFERENCE;}
<PREVIOUS_COMMENT> {STRING_TAIL} { return GetTextTokenTypes.PREVIOUS_COMMENT;}
<FLAG_COMMENT> {PASCAL_FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.FORMAT_FLAG;}
<FLAG_COMMENT> {NO_PASCAL_FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.NO_FORMAT_FLAG;}
<FLAG_COMMENT> {QT_FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.FORMAT_FLAG;}
<FLAG_COMMENT> {NO_QT_FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.NO_FORMAT_FLAG;}
<FLAG_COMMENT> {FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.FORMAT_FLAG;}
<FLAG_COMMENT> {NO_FORMAT_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.NO_FORMAT_FLAG;}
<FLAG_COMMENT> {FUZZY_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.FUZZY_FLAG;}
<FLAG_COMMENT> {RANGE_FLAG} { yybegin(FLAG_DEL); return GetTextTokenTypes.RANGE_FLAG;}
<FLAG_DEL> {FLAG_DELIVERY} { yybegin(FLAG_COMMENT); return GetTextTokenTypes.FLAG_DELIVERY;}
<FLAG_COMMENT, FLAG_DEL> {SPACE} { return GetTextTokenTypes.FLAG_DELIVERY;}
<FLAG_COMMENT, FLAG_DEL> {NUMBER} { return GetTextTokenTypes.RANGE_NUMBER;}
<FLAG_COMMENT, FLAG_DEL> {COLON} { return GetTextTokenTypes.COLON;}
<FLAG_COMMENT, FLAG_DEL> {DOTS} { return GetTextTokenTypes.DOTS;}
<FLAG_COMMENT, FLAG_DEL> [^] { return GetTextTokenTypes.BAD_FLAG_COMMENT; }
{MSGCTXT} { return GetTextTokenTypes.MSGCTXT;}
{MSGCTXT} { return GetTextTokenTypes.MSGCTXT;}
{MSGID} { return GetTextTokenTypes.MSGID;}
{MSGID_PLURAL} { return GetTextTokenTypes.MSGID_PLURAL;}
{MSGSTR} { return GetTextTokenTypes.MSGSTR;}
<YYINITIAL> {LETTERS} { return GetTextTokenTypes.COMMAND;}
<YYINITIAL> {WHITE_SPACE} { return GetTextTokenTypes.WHITE_SPACE;}
<FLAG_COMMENT, FLAG_DEL> {SPACE} { return GetTextTokenTypes.WHITE_SPACE;}
{NUMBER} { return GetTextTokenTypes.NUMBER;}
{LBRACE} { return GetTextTokenTypes.LBRACE;}
{RBRACE} { return GetTextTokenTypes.RBRACE;}
{COLON} { return GetTextTokenTypes.COLON;}
{DOTS} { return GetTextTokenTypes.DOTS;}
{DOUBLEQUOTE} { return GetTextTokenTypes.QUOTE;}
{QUOTED_STRING} { return GetTextTokenTypes.STRING;}
@@ -1,21 +0,0 @@
package com.jetbrains.gettext;
import com.intellij.lang.Language;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.SingleRootFileViewProvider;
import org.jetbrains.annotations.NotNull;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextFileViewProvider extends SingleRootFileViewProvider {
protected GetTextFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean physical, @NotNull Language language) {
super(manager, virtualFile, physical, language);
}
public boolean supportsIncrementalReparse(@NotNull final Language rootLanguage) {
return false;
}
}
@@ -1,18 +0,0 @@
package com.jetbrains.gettext;
import com.intellij.lang.Language;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.FileViewProvider;
import com.intellij.psi.FileViewProviderFactory;
import com.intellij.psi.PsiManager;
import org.jetbrains.annotations.NotNull;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextFileViewProviderFactory implements FileViewProviderFactory {
public FileViewProvider createFileViewProvider(@NotNull VirtualFile file, Language language, @NotNull PsiManager manager, boolean physical) {
return new GetTextFileViewProvider(manager, file, physical, language);
}
}
@@ -24,9 +24,9 @@ public interface GetTextTokenTypes {
IElementType FORMAT_FLAG = new GetTextElementType("FORMAT_FLAG");
IElementType NO_FORMAT_FLAG = new GetTextElementType("NO_FORMAT_FLAG");
IElementType FLAG_DELIVERY = new GetTextElementType("DELIVERY");
IElementType BAD_FLAG_COMMENT = new GetTextElementType("BAD_FLAG_COMMENT");
IElementType MSG = new GetTextElementType("MSG_START");
IElementType COMMAND = new GetTextElementType("COMMAND");
IElementType MSGCTXT = new GetTextElementType("MSGCTXT");
IElementType MSGID = new GetTextElementType("MSGID");
IElementType MSGID_PLURAL = new GetTextElementType("MSGID_PLURAL");
@@ -35,15 +35,20 @@ public interface GetTextTokenTypes {
IElementType COLON = new GetTextElementType("COLON");
IElementType DOTS = new GetTextElementType("DOTS");
IElementType NUMBER = new GetTextElementType("NUMBER");
IElementType RANGE_NUMBER = new GetTextElementType("RANGE_NUMBER");
IElementType LBRACE = new GetTextElementType("LBRACE");
IElementType RBRACE = new GetTextElementType("RBRACE");
IElementType QUOTE = new GetTextElementType("QUOTE");
IElementType STRING = new GetTextElementType("STRING");
TokenSet SYSTEM_COMMENTS = TokenSet.create(EXTR_COMMENT, REFERENCE, FLAG_COMMENT, PREVIOUS_COMMENT, FLAG_DELIVERY, COMMENT_SYMBOLS);
TokenSet SYSTEM_COMMENTS = TokenSet.create(EXTR_COMMENT, REFERENCE, FLAG_COMMENT, PREVIOUS_COMMENT,
FLAG_DELIVERY, COMMENT_SYMBOLS, BAD_FLAG_COMMENT);
TokenSet COMMENTS = TokenSet.orSet(TokenSet.create(COMMENT), SYSTEM_COMMENTS);
TokenSet STRING_LITERALS = TokenSet.create(STRING);
TokenSet KEYWORDS = TokenSet.create(MSG, MSGCTXT, MSGID, MSGID_PLURAL, MSGSTR);
TokenSet STRING_LITERALS = TokenSet.create(STRING, QUOTE);
TokenSet KEYWORDS = TokenSet.create(MSGCTXT, MSGID, MSGID_PLURAL, MSGSTR, COMMAND);
TokenSet FLAGS = TokenSet.create(FUZZY_FLAG, FORMAT_FLAG, NO_FORMAT_FLAG, RANGE_FLAG);
TokenSet FLAG_LINE = TokenSet.orSet(FLAGS, TokenSet.create(FLAG_COMMENT,FLAG_DELIVERY, BAD_FLAG_COMMENT, COLON, DOTS, RANGE_NUMBER));
TokenSet BRACES = TokenSet.create(LBRACE, RBRACE);
TokenSet NUMBERS = TokenSet.create(NUMBER, RANGE_NUMBER);
}
@@ -1,4 +1,4 @@
/* The following code was generated by JFlex 1.4.3 on 7/10/12 5:05 PM */
/* The following code was generated by JFlex 1.4.3 on 7/11/12 4:30 PM */
package com.jetbrains.gettext;
@@ -9,7 +9,7 @@ import com.intellij.psi.tree.IElementType;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 7/10/12 5:05 PM from the specification file
* on 7/11/12 4:30 PM from the specification file
* <tt>/home/svetlana/git/idea/IDEA/tools/lexer/../../community/plugins/gettext/src/com/jetbrains/gettext/GetText.flex</tt>
*/
class _GetTextLexer implements FlexLexer {
@@ -41,13 +41,13 @@ class _GetTextLexer implements FlexLexer {
*/
private static final String ZZ_CMAP_PACKED =
"\11\0\1\3\1\2\1\0\1\3\1\1\22\0\1\3\1\0\1\4"+
"\1\10\10\0\1\13\1\40\1\11\1\0\12\7\1\12\6\0\1\32"+
"\1\41\1\20\1\24\1\44\1\33\1\17\1\43\1\23\1\42\1\45"+
"\1\27\1\15\1\36\1\37\1\26\1\50\1\31\1\16\1\21\1\30"+
"\1\46\1\47\1\22\1\35\1\34\1\5\1\0\1\6\1\0\1\25"+
"\1\0\1\32\1\41\1\20\1\24\1\44\1\33\1\17\1\43\1\23"+
"\1\42\1\45\1\27\1\15\1\36\1\37\1\26\1\50\1\31\1\16"+
"\1\21\1\30\1\46\1\47\1\22\1\35\1\34\1\0\1\14\uff83\0";
"\1\11\10\0\1\15\1\37\1\12\1\0\12\7\1\13\6\0\1\33"+
"\1\42\1\21\1\25\1\45\1\34\1\20\1\44\1\24\1\43\1\46"+
"\1\30\1\16\1\41\1\40\1\27\1\10\1\32\1\17\1\22\1\31"+
"\1\47\1\50\1\23\1\36\1\35\1\5\1\0\1\6\1\0\1\26"+
"\1\0\1\33\1\42\1\21\1\25\1\45\1\34\1\20\1\44\1\24"+
"\1\43\1\46\1\30\1\16\1\41\1\40\1\27\1\10\1\32\1\17"+
"\1\22\1\31\1\47\1\50\1\23\1\36\1\35\1\0\1\14\uff83\0";
/**
* Translates characters to character classes
@@ -60,15 +60,18 @@ class _GetTextLexer implements FlexLexer {
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\2\1\1\2\1\3\1\4\1\5\2\1\1\6\2\7"+
"\1\6\1\10\1\11\1\1\1\12\1\6\1\13\1\6"+
"\2\14\1\15\1\16\1\17\1\20\1\21\2\2\2\3"+
"\2\4\2\5\21\6\1\22\1\0\2\23\1\24\101\0"+
"\1\25\3\0\1\26\1\27\22\0\1\30\20\0\1\31"+
"\17\0\1\32\23\0\1\33\1\0\1\34\2\0";
"\1\1\1\2\1\3\1\4\1\5\1\6\2\7\1\10"+
"\2\11\1\12\1\13\1\14\1\2\1\1\1\15\1\1"+
"\2\16\1\17\1\20\1\21\1\22\1\23\1\10\2\3"+
"\2\4\2\5\2\6\1\24\1\25\1\24\1\7\2\24"+
"\1\26\21\24\1\27\1\0\2\30\1\1\2\0\1\31"+
"\24\0\1\1\21\0\3\1\36\0\2\1\1\32\2\0"+
"\1\32\6\0\1\33\1\34\23\0\1\35\1\1\1\0"+
"\1\35\24\0\1\36\1\0\1\36\23\0\1\37\34\0"+
"\1\40\2\0\1\41\3\0";
private static int [] zzUnpackAction() {
int [] result = new int[203];
int [] result = new int[252];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -94,34 +97,40 @@ class _GetTextLexer implements FlexLexer {
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\51\0\122\0\173\0\244\0\315\0\366\0\u011f"+
"\0\u0148\0\u0171\0\u0148\0\u019a\0\u0148\0\u0148\0\u01c3\0\u0148"+
"\0\u01ec\0\u0148\0\u0215\0\u023e\0\u0148\0\u0148\0\u01ec\0\u0148"+
"\0\u0148\0\u0148\0\u0267\0\u0290\0\u02b9\0\u02e2\0\u030b\0\u0334"+
"\0\u035d\0\u0386\0\u03af\0\u03d8\0\u0401\0\u042a\0\u0453\0\u047c"+
"\0\u04a5\0\u04ce\0\u04f7\0\u0520\0\u0549\0\u0572\0\u059b\0\u05c4"+
"\0\u05ed\0\u0616\0\u063f\0\u0148\0\u019a\0\u0668\0\u0148\0\u0148"+
"\0\u0691\0\u06ba\0\u06e3\0\u0401\0\u070c\0\u0735\0\u075e\0\u0787"+
"\0\u07b0\0\u07d9\0\u0802\0\u082b\0\u0854\0\u087d\0\u08a6\0\u08cf"+
"\0\u0148\0\u0171\0\u0148\0\u019a\0\u0148\0\u0148\0\u01c3\0\u01ec"+
"\0\u0148\0\u0215\0\u023e\0\u0148\0\u0148\0\u0267\0\u0290\0\u02b9"+
"\0\u0148\0\u02e2\0\u030b\0\u0334\0\u035d\0\u0386\0\u03af\0\u03d8"+
"\0\u0401\0\u042a\0\u0148\0\u0148\0\u019a\0\u0453\0\u047c\0\u04a5"+
"\0\u0148\0\u02e2\0\u04ce\0\u04f7\0\u0520\0\u0549\0\u0572\0\u059b"+
"\0\u05c4\0\u05ed\0\u0616\0\u063f\0\u0668\0\u0691\0\u06ba\0\u06e3"+
"\0\u070c\0\u0735\0\u0148\0\u019a\0\u075e\0\u0148\0\u0787\0\u07b0"+
"\0\u07d9\0\u0148\0\u0802\0\u082b\0\u0854\0\u087d\0\u08a6\0\u08cf"+
"\0\u08f8\0\u0921\0\u094a\0\u0973\0\u099c\0\u09c5\0\u09ee\0\u0a17"+
"\0\u0a40\0\u0a69\0\u0a92\0\u0abb\0\u0ae4\0\u0b0d\0\u0b36\0\u0b5f"+
"\0\u0b88\0\u0bb1\0\u0bda\0\u0c03\0\u0c2c\0\u0c55\0\u0c7e\0\u0ca7"+
"\0\u0cd0\0\u0cf9\0\u0d22\0\u0d4b\0\u0d74\0\u0d9d\0\u0dc6\0\u0def"+
"\0\u0e18\0\u0e41\0\u0e6a\0\u0e93\0\u0ebc\0\u0ee5\0\u0f0e\0\u0f37"+
"\0\u0f60\0\u0f89\0\u0fb2\0\u0fdb\0\u1004\0\u102d\0\u1056\0\u107f"+
"\0\u10a8\0\u10d1\0\u10fa\0\u1123\0\u114c\0\u0148\0\u0148\0\u1175"+
"\0\u119e\0\u11c7\0\u11f0\0\u1219\0\u1242\0\u126b\0\u1294\0\u12bd"+
"\0\u12e6\0\u130f\0\u1338\0\u1361\0\u138a\0\u13b3\0\u13dc\0\u1405"+
"\0\u142e\0\u0148\0\u1457\0\u1480\0\u14a9\0\u14d2\0\u14fb\0\u1524"+
"\0\u154d\0\u1576\0\u159f\0\u15c8\0\u15f1\0\u161a\0\u1643\0\u166c"+
"\0\u1695\0\u16be\0\u0148\0\u16e7\0\u1710\0\u1739\0\u1762\0\u178b"+
"\0\u17b4\0\u17dd\0\u1806\0\u182f\0\u1858\0\u1881\0\u18aa\0\u18d3"+
"\0\u18fc\0\u1925\0\u0148\0\u194e\0\u1977\0\u19a0\0\u19c9\0\u19f2"+
"\0\u1a1b\0\u1a44\0\u1a6d\0\u1a96\0\u1abf\0\u1ae8\0\u1b11\0\u1b3a"+
"\0\u1b63\0\u1b8c\0\u1bb5\0\u1bde\0\u1c07\0\u1c30\0\u0148\0\u1c59"+
"\0\u0148\0\u1c82\0\u1cab";
"\0\u10a8\0\u10d1\0\u10fa\0\u1123\0\u114c\0\u1175\0\u119e\0\u11c7"+
"\0\u11f0\0\u1219\0\u1242\0\u126b\0\u1294\0\u12bd\0\u12e6\0\u130f"+
"\0\u1338\0\u1361\0\u138a\0\u13b3\0\u13dc\0\u1405\0\u142e\0\u1457"+
"\0\u1480\0\u14a9\0\u14d2\0\u14fb\0\u1524\0\u0148\0\u0148\0\u154d"+
"\0\u1576\0\u159f\0\u15c8\0\u15f1\0\u161a\0\u1643\0\u166c\0\u1695"+
"\0\u16be\0\u16e7\0\u1710\0\u1739\0\u1762\0\u178b\0\u17b4\0\u17dd"+
"\0\u1806\0\u182f\0\u01ec\0\u1858\0\u1881\0\u0148\0\u18aa\0\u18d3"+
"\0\u18fc\0\u1925\0\u194e\0\u1977\0\u19a0\0\u19c9\0\u19f2\0\u1a1b"+
"\0\u1a44\0\u1a6d\0\u1a96\0\u1abf\0\u1ae8\0\u1b11\0\u1b3a\0\u1b63"+
"\0\u1b8c\0\u1bb5\0\u01ec\0\u1bde\0\u0148\0\u1c07\0\u1c30\0\u1c59"+
"\0\u1c82\0\u1cab\0\u1cd4\0\u1cfd\0\u1d26\0\u1d4f\0\u1d78\0\u1da1"+
"\0\u1dca\0\u1df3\0\u1e1c\0\u1e45\0\u1e6e\0\u1e97\0\u1ec0\0\u1ee9"+
"\0\u0148\0\u1f12\0\u1f3b\0\u1f64\0\u1f8d\0\u1fb6\0\u1fdf\0\u2008"+
"\0\u2031\0\u205a\0\u2083\0\u20ac\0\u20d5\0\u20fe\0\u2127\0\u2150"+
"\0\u2179\0\u21a2\0\u21cb\0\u21f4\0\u221d\0\u2246\0\u226f\0\u2298"+
"\0\u22c1\0\u22ea\0\u2313\0\u233c\0\u2365\0\u0148\0\u238e\0\u23b7"+
"\0\u0148\0\u23e0\0\u2409\0\u2432";
private static int [] zzUnpackRowMap() {
int [] result = new int[203];
int [] result = new int[252];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -145,76 +154,98 @@ class _GetTextLexer implements FlexLexer {
private static final String ZZ_TRANS_PACKED_0 =
"\1\11\1\12\2\13\1\14\1\15\1\16\1\17\1\20"+
"\1\21\1\22\2\11\1\23\34\11\1\24\1\25\1\26"+
"\1\14\1\15\1\16\1\17\1\11\1\27\1\30\1\31"+
"\1\32\1\23\33\11\1\33\1\24\1\25\1\33\1\34"+
"\44\33\1\35\1\24\1\25\1\35\1\36\44\35\1\37"+
"\1\24\1\25\1\37\1\40\44\37\1\41\1\24\1\25"+
"\1\41\1\42\44\41\1\11\1\24\1\25\1\13\1\14"+
"\1\15\1\16\1\17\1\11\1\21\1\22\2\11\1\23"+
"\1\43\1\44\1\45\1\46\4\11\1\47\1\50\1\11"+
"\1\51\1\52\1\53\1\11\1\54\1\55\1\56\1\11"+
"\1\57\1\60\1\11\1\61\1\62\2\11\1\63\1\11"+
"\1\24\1\25\1\13\1\14\1\15\1\16\1\17\1\11"+
"\1\21\1\22\1\64\1\11\1\23\33\11\53\0\1\13"+
"\46\0\1\65\1\66\1\67\1\65\1\67\44\65\7\0"+
"\1\17\52\0\1\70\55\0\1\71\34\0\1\25\46\0"+
"\1\33\2\0\46\33\1\34\1\66\1\67\1\34\1\33"+
"\44\34\1\35\2\0\46\35\1\36\1\66\1\67\1\36"+
"\1\35\44\36\1\37\2\0\46\37\1\40\1\66\1\67"+
"\1\40\1\37\44\40\1\41\2\0\46\41\1\42\1\66"+
"\1\67\1\42\1\41\44\42\15\0\1\72\2\0\1\73"+
"\22\0\1\74\25\0\1\75\12\0\1\75\55\0\1\76"+
"\30\0\1\77\65\0\1\100\5\0\1\101\1\102\27\0"+
"\1\103\57\0\1\104\65\0\1\105\31\0\1\106\40\0"+
"\1\101\67\0\1\107\52\0\1\110\46\0\1\111\43\0"+
"\1\112\41\0\1\113\51\0\1\114\45\0\1\115\31\0"+
"\1\67\65\0\1\116\63\0\1\117\61\0\1\120\25\0"+
"\1\74\63\0\1\121\44\0\1\74\42\0\1\122\55\0"+
"\1\74\53\0\1\77\35\0\1\101\22\0\1\123\45\0"+
"\1\124\57\0\1\74\37\0\1\125\54\0\1\126\52\0"+
"\1\127\45\0\1\130\57\0\1\131\20\0\1\101\76\0"+
"\1\74\31\0\1\132\12\0\1\133\26\0\1\134\1\0"+
"\1\135\2\0\1\136\54\0\1\137\53\0\1\140\11\0"+
"\1\141\43\0\1\142\54\0\1\143\36\0\1\144\36\0"+
"\1\145\65\0\1\146\32\0\1\147\1\150\1\151\1\152"+
"\4\0\1\153\1\154\2\0\1\155\2\0\1\156\1\0"+
"\1\157\1\0\1\160\1\161\1\0\1\162\1\163\2\0"+
"\1\164\20\0\1\74\23\0\1\165\22\0\1\166\64\0"+
"\1\74\44\0\1\167\50\0\1\167\4\0\1\121\36\0"+
"\1\170\50\0\1\171\53\0\1\172\53\0\1\173\52\0"+
"\1\101\34\0\1\114\64\0\1\174\56\0\1\175\55\0"+
"\1\101\50\0\1\176\41\0\1\177\30\0\1\200\2\0"+
"\1\201\22\0\1\151\25\0\1\202\12\0\1\202\55\0"+
"\1\203\30\0\1\204\65\0\1\205\5\0\1\206\1\207"+
"\27\0\1\210\74\0\1\211\21\0\1\206\71\0\1\212"+
"\46\0\1\213\43\0\1\214\41\0\1\215\51\0\1\216"+
"\45\0\1\217\47\0\1\220\51\0\1\74\56\0\1\221"+
"\52\0\1\222\41\0\1\223\53\0\1\224\44\0\1\225"+
"\44\0\1\226\71\0\1\74\44\0\1\227\61\0\1\230"+
"\25\0\1\151\63\0\1\231\44\0\1\151\42\0\1\232"+
"\55\0\1\151\53\0\1\204\35\0\1\206\22\0\1\233"+
"\54\0\1\151\45\0\1\234\45\0\1\235\57\0\1\236"+
"\20\0\1\206\76\0\1\151\31\0\1\237\12\0\1\240"+
"\31\0\1\241\57\0\1\242\41\0\1\243\55\0\1\244"+
"\54\0\1\245\50\0\1\246\45\0\1\247\53\0\1\250"+
"\11\0\1\251\43\0\1\252\54\0\1\253\36\0\1\254"+
"\37\0\1\151\23\0\1\255\22\0\1\256\64\0\1\151"+
"\44\0\1\257\50\0\1\257\4\0\1\231\42\0\1\260"+
"\12\0\1\260\41\0\1\261\46\0\1\262\50\0\1\105"+
"\42\0\1\263\56\0\1\264\52\0\1\206\34\0\1\216"+
"\64\0\1\265\56\0\1\266\55\0\1\206\24\0\1\267"+
"\51\0\1\151\56\0\1\270\47\0\1\271\54\0\1\77"+
"\46\0\1\272\41\0\1\273\44\0\1\274\71\0\1\151"+
"\33\0\1\275\57\0\1\276\52\0\1\277\47\0\1\300"+
"\51\0\1\301\50\0\1\302\43\0\1\303\12\0\1\303"+
"\41\0\1\304\35\0\1\305\64\0\1\306\45\0\1\211"+
"\42\0\1\307\55\0\1\310\54\0\1\204\36\0\1\261"+
"\57\0\1\311\53\0\1\312\34\0\1\313\52\0\1\304"+
"\30\0";
"\1\21\4\11\1\22\7\20\1\11\10\20\1\11\11\20"+
"\1\11\1\23\1\24\1\25\1\14\1\15\1\16\1\17"+
"\2\11\1\26\1\27\1\30\1\31\1\32\32\11\1\33"+
"\1\23\1\24\1\33\1\34\44\33\1\35\1\23\1\24"+
"\1\35\1\36\44\35\1\37\1\23\1\24\1\37\1\40"+
"\44\37\1\41\1\23\1\24\1\41\1\42\44\41\1\43"+
"\1\23\1\24\1\44\1\45\2\43\1\46\1\47\1\43"+
"\1\50\1\51\2\43\1\52\1\53\1\54\1\55\1\56"+
"\4\43\1\57\1\60\1\43\1\61\1\62\1\63\1\43"+
"\1\64\1\43\1\65\1\66\1\67\1\70\1\43\1\71"+
"\1\72\3\43\1\23\1\24\1\44\1\45\2\43\1\46"+
"\2\43\1\50\1\51\1\43\1\73\1\52\32\43\53\0"+
"\1\13\46\0\1\74\1\75\1\76\1\74\1\76\44\74"+
"\7\0\1\17\51\0\1\20\5\0\10\20\1\0\10\20"+
"\1\0\11\20\10\0\1\20\5\0\1\20\1\77\6\20"+
"\1\0\10\20\1\0\11\20\2\0\1\24\46\0\1\26"+
"\2\0\46\26\1\27\2\0\46\27\1\30\2\0\46\30"+
"\17\0\1\100\31\0\1\33\2\0\46\33\1\34\1\75"+
"\1\76\1\34\1\33\44\34\1\35\2\0\46\35\1\36"+
"\1\75\1\76\1\36\1\35\44\36\1\37\2\0\46\37"+
"\1\40\1\75\1\76\1\40\1\37\44\40\1\41\2\0"+
"\46\41\1\42\1\75\1\76\1\42\1\41\44\42\7\0"+
"\1\46\63\0\1\101\40\0\1\102\54\0\1\103\2\0"+
"\1\104\22\0\1\105\25\0\1\106\12\0\1\106\33\0"+
"\1\107\17\0\1\110\32\0\1\111\65\0\1\112\5\0"+
"\1\113\1\114\27\0\1\115\57\0\1\116\65\0\1\117"+
"\31\0\1\120\40\0\1\113\71\0\1\121\46\0\1\122"+
"\50\0\1\123\43\0\1\124\45\0\1\125\45\0\1\126"+
"\25\0\1\76\56\0\1\20\5\0\2\20\1\127\5\20"+
"\1\0\10\20\1\0\11\20\20\0\1\130\67\0\1\131"+
"\44\0\1\132\61\0\1\133\43\0\1\110\32\0\1\134"+
"\73\0\1\135\40\0\1\136\44\0\1\105\42\0\1\137"+
"\55\0\1\105\53\0\1\140\35\0\1\113\22\0\1\141"+
"\47\0\1\142\55\0\1\105\37\0\1\143\56\0\1\144"+
"\44\0\1\145\51\0\1\146\57\0\1\147\25\0\1\150"+
"\71\0\1\105\13\0\1\20\5\0\1\20\1\151\1\20"+
"\1\152\2\20\1\153\1\20\1\0\10\20\1\0\11\20"+
"\17\0\1\154\1\0\1\155\2\0\1\156\53\0\1\157"+
"\4\0\1\136\44\0\1\160\65\0\1\161\42\0\1\162"+
"\44\0\1\163\55\0\1\164\54\0\1\165\34\0\1\166"+
"\52\0\1\167\36\0\1\170\65\0\1\171\34\0\1\105"+
"\23\0\1\172\13\0\1\173\6\0\1\174\1\175\1\176"+
"\1\177\4\0\1\200\1\201\2\0\1\202\2\0\1\203"+
"\1\0\1\204\1\0\1\205\1\206\1\0\1\207\1\210"+
"\21\0\1\211\64\0\1\105\34\0\1\113\41\0\1\20"+
"\5\0\4\20\1\212\3\20\1\0\10\20\1\0\11\20"+
"\10\0\1\20\5\0\4\20\1\213\3\20\1\0\10\20"+
"\1\0\11\20\10\0\1\20\5\0\7\20\1\214\1\0"+
"\10\20\1\0\11\20\22\0\1\215\50\0\1\216\53\0"+
"\1\217\53\0\1\220\50\0\1\221\36\0\1\126\56\0"+
"\1\222\56\0\1\113\50\0\1\223\56\0\1\224\47\0"+
"\1\225\56\0\1\113\50\0\1\226\41\0\1\227\33\0"+
"\1\230\51\0\1\231\44\0\1\232\2\0\1\233\22\0"+
"\1\234\25\0\1\235\12\0\1\235\33\0\1\236\17\0"+
"\1\237\32\0\1\240\65\0\1\241\5\0\1\242\1\243"+
"\27\0\1\244\74\0\1\245\21\0\1\242\71\0\1\246"+
"\46\0\1\247\43\0\1\250\45\0\1\251\45\0\1\252"+
"\45\0\1\105\36\0\1\20\5\0\10\20\1\0\3\20"+
"\1\253\4\20\1\0\11\20\10\0\1\20\5\0\5\20"+
"\1\254\2\20\1\0\10\20\1\0\11\20\10\0\1\20"+
"\5\0\10\20\1\255\10\20\1\0\11\20\32\0\1\256"+
"\41\0\1\257\53\0\1\255\53\0\1\260\41\0\1\261"+
"\67\0\1\262\25\0\1\263\73\0\1\105\51\0\1\264"+
"\30\0\1\265\65\0\1\266\44\0\1\267\61\0\1\270"+
"\43\0\1\237\32\0\1\271\73\0\1\272\40\0\1\273"+
"\44\0\1\234\42\0\1\274\55\0\1\234\53\0\1\275"+
"\35\0\1\242\22\0\1\276\54\0\1\234\45\0\1\277"+
"\45\0\1\300\57\0\1\301\25\0\1\302\71\0\1\234"+
"\13\0\1\20\5\0\4\20\1\303\3\20\1\0\10\20"+
"\1\0\11\20\27\0\1\304\43\0\1\305\60\0\1\306"+
"\51\0\1\307\37\0\1\310\61\0\1\311\47\0\1\312"+
"\55\0\1\313\40\0\1\314\4\0\1\273\44\0\1\315"+
"\65\0\1\316\42\0\1\317\44\0\1\320\55\0\1\321"+
"\54\0\1\322\34\0\1\323\52\0\1\324\37\0\1\234"+
"\23\0\1\325\22\0\1\326\64\0\1\234\34\0\1\242"+
"\61\0\1\327\53\0\1\111\45\0\1\117\65\0\1\330"+
"\25\0\1\331\61\0\1\332\44\0\1\333\51\0\1\334"+
"\50\0\1\335\36\0\1\252\56\0\1\336\56\0\1\242"+
"\50\0\1\337\56\0\1\340\47\0\1\341\56\0\1\242"+
"\24\0\1\342\51\0\1\234\57\0\1\343\51\0\1\344"+
"\37\0\1\126\62\0\1\345\46\0\1\346\41\0\1\347"+
"\67\0\1\350\25\0\1\351\73\0\1\234\51\0\1\352"+
"\30\0\1\353\60\0\1\354\57\0\1\306\26\0\1\355"+
"\63\0\1\356\51\0\1\357\37\0\1\360\61\0\1\361"+
"\47\0\1\362\55\0\1\363\44\0\1\364\36\0\1\306"+
"\62\0\1\240\45\0\1\245\65\0\1\365\25\0\1\366"+
"\61\0\1\367\44\0\1\370\51\0\1\371\52\0\1\372"+
"\37\0\1\252\62\0\1\373\56\0\1\356\26\0\1\374"+
"\52\0\1\356\27\0";
private static int [] zzUnpackTrans() {
int [] result = new int[7380];
int [] result = new int[9307];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -255,14 +286,16 @@ class _GetTextLexer implements FlexLexer {
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\10\1\1\11\1\1\1\11\1\1\2\11\1\1\1\11"+
"\1\1\1\11\2\1\2\11\1\1\3\11\31\1\1\11"+
"\1\0\1\1\2\11\101\0\1\1\3\0\2\11\22\0"+
"\1\11\20\0\1\11\17\0\1\11\23\0\1\11\1\0"+
"\1\11\2\0";
"\10\1\1\11\1\1\1\11\1\1\2\11\2\1\1\11"+
"\2\1\2\11\3\1\1\11\11\1\2\11\4\1\1\11"+
"\21\1\1\11\1\0\1\1\1\11\1\1\2\0\1\11"+
"\24\0\1\1\21\0\3\1\36\0\3\1\2\0\1\1"+
"\6\0\2\11\23\0\2\1\1\0\1\11\24\0\1\1"+
"\1\0\1\11\23\0\1\11\34\0\1\11\2\0\1\11"+
"\3\0";
private static int [] zzUnpackAttribute() {
int [] result = new int[203];
int [] result = new int[252];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -574,118 +607,138 @@ class _GetTextLexer implements FlexLexer {
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 2:
case 3:
{ return GetTextTokenTypes.COMMENT;
}
case 29: break;
case 27:
case 34: break;
case 32:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.NO_FORMAT_FLAG;
}
case 30: break;
case 25:
case 35: break;
case 30:
{ return GetTextTokenTypes.MSGCTXT;
}
case 31: break;
case 14:
{ yybegin(EXTR_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
}
case 32: break;
case 7:
{ return GetTextTokenTypes.WHITE_SPACE;
}
case 33: break;
case 8:
{ return GetTextTokenTypes.LBRACE;
}
case 34: break;
case 10:
{ yybegin(START_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
}
case 35: break;
case 26:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.FORMAT_FLAG;
}
case 36: break;
case 6:
{ return GetTextTokenTypes.BAD_CHARACTER;
case 10:
{ return GetTextTokenTypes.QUOTE;
}
case 37: break;
case 9:
{ return GetTextTokenTypes.RBRACE;
{ return GetTextTokenTypes.WHITE_SPACE;
}
case 38: break;
case 12:
{ yybegin(YYINITIAL); return GetTextTokenTypes.WHITE_SPACE;
case 11:
{ return GetTextTokenTypes.LBRACE;
}
case 39: break;
case 16:
{ yybegin(FLAG_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
case 18:
{ yybegin(PREVIOUS_COMMENT); return GetTextTokenTypes.PREVIOUS_COMMENT;
}
case 40: break;
case 17:
{ yybegin(PREVIOUS_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
case 13:
{ yybegin(START_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
}
case 41: break;
case 20:
{ return GetTextTokenTypes.DOTS;
case 31:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.FORMAT_FLAG;
}
case 42: break;
case 4:
{ return GetTextTokenTypes.REFERENCE;
case 8:
{ return GetTextTokenTypes.BAD_CHARACTER;
}
case 43: break;
case 24:
{ return GetTextTokenTypes.MSGSTR;
case 21:
{ return GetTextTokenTypes.FLAG_DELIVERY;
}
case 44: break;
case 19:
{ return GetTextTokenTypes.STRING;
case 12:
{ return GetTextTokenTypes.RBRACE;
}
case 45: break;
case 15:
{ yybegin(REFERENCE_COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
case 14:
{ yybegin(YYINITIAL); return GetTextTokenTypes.WHITE_SPACE;
}
case 46: break;
case 22:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.RANGE_FLAG;
case 25:
{ return GetTextTokenTypes.DOTS;
}
case 47: break;
case 11:
{ return GetTextTokenTypes.COLON;
case 5:
{ return GetTextTokenTypes.REFERENCE;
}
case 48: break;
case 1:
{ return GetTextTokenTypes.NUMBER;
case 29:
{ return GetTextTokenTypes.MSGSTR;
}
case 49: break;
case 18:
{ yybegin(FLAG_COMMENT); return GetTextTokenTypes.FLAG_DELIVERY;
case 24:
{ return GetTextTokenTypes.STRING;
}
case 50: break;
case 3:
{ return GetTextTokenTypes.EXTR_COMMENT;
case 7:
{ return GetTextTokenTypes.RANGE_NUMBER;
}
case 51: break;
case 21:
{ return GetTextTokenTypes.MSGID;
case 27:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.RANGE_FLAG;
}
case 52: break;
case 5:
{ return GetTextTokenTypes.PREVIOUS_COMMENT;
case 22:
{ return GetTextTokenTypes.COLON;
}
case 53: break;
case 28:
{ return GetTextTokenTypes.MSGID_PLURAL;
case 2:
{ return GetTextTokenTypes.NUMBER;
}
case 54: break;
case 23:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.FUZZY_FLAG;
case 20:
{ return GetTextTokenTypes.BAD_FLAG_COMMENT;
}
case 55: break;
case 13:
{ yybegin(COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
case 23:
{ yybegin(FLAG_COMMENT); return GetTextTokenTypes.FLAG_DELIVERY;
}
case 56: break;
case 4:
{ return GetTextTokenTypes.EXTR_COMMENT;
}
case 57: break;
case 26:
{ return GetTextTokenTypes.MSGID;
}
case 58: break;
case 17:
{ yybegin(REFERENCE_COMMENT); return GetTextTokenTypes.REFERENCE;
}
case 59: break;
case 6:
{ return GetTextTokenTypes.PREVIOUS_COMMENT;
}
case 60: break;
case 19:
{ yybegin(FLAG_COMMENT); return GetTextTokenTypes.FLAG_COMMENT;
}
case 61: break;
case 33:
{ return GetTextTokenTypes.MSGID_PLURAL;
}
case 62: break;
case 28:
{ yybegin(FLAG_DEL); return GetTextTokenTypes.FUZZY_FLAG;
}
case 63: break;
case 15:
{ yybegin(COMMENT); return GetTextTokenTypes.COMMENT_SYMBOLS;
}
case 64: break;
case 1:
{ return GetTextTokenTypes.COMMAND;
}
case 65: break;
case 16:
{ yybegin(EXTR_COMMENT); return GetTextTokenTypes.EXTR_COMMENT;
}
case 66: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
@@ -0,0 +1,45 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.gettext.completion;
import com.intellij.lang.BracePair;
import com.intellij.lang.PairedBraceMatcher;
import com.intellij.psi.PsiFile;
import com.intellij.psi.tree.IElementType;
import com.jetbrains.gettext.GetTextTokenTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextBraceMatcher implements PairedBraceMatcher {
private static final BracePair[] PAIRS = new BracePair[]{
new BracePair(GetTextTokenTypes.LBRACE, GetTextTokenTypes.RBRACE, false)
};
public BracePair[] getPairs() {
return PAIRS;
}
public boolean isPairedBracesAllowedBeforeType(@NotNull final IElementType lbraceType, @Nullable final IElementType tokenType) {
return true;
}
public int getCodeConstructStart(final PsiFile file, int openingBraceOffset) {
return openingBraceOffset;
}
}
@@ -0,0 +1,44 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.gettext.completion;
import com.intellij.lang.Commenter;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextCommenter implements Commenter {
public String getLineCommentPrefix() {
return "# ";
}
public String getBlockCommentPrefix() {
return null;
}
public String getBlockCommentSuffix() {
return null;
}
public String getCommentedBlockCommentPrefix() {
return null;
}
public String getCommentedBlockCommentSuffix() {
return null;
}
}
@@ -3,9 +3,11 @@ package com.jetbrains.gettext.completion;
import com.intellij.codeInsight.completion.*;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.util.ProcessingContext;
import com.jetbrains.gettext.GetTextLanguage;
import com.jetbrains.gettext.GetTextTokenTypes;
import com.jetbrains.gettext.lang.GetTextFlags;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -16,52 +18,28 @@ import static com.intellij.patterns.PlatformPatterns.psiElement;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextCompletitionContributor extends CompletionContributor {
public class GetTextCompletionContributor extends CompletionContributor {
private final static String[] KEYWORDS = {
"msgid",
"msgstr",
"msgctxt",
"msgid_plural",
"fuzzy",
"c-format"
"msgid_plural"
};
//private final static String[] BUILT_IN_FILTERS = {
// "date",
// "format",
// "replace",
// "url_encode",
// "json_encode",
// "title",
// "capitalize",
// "upper",
// "lower",
// "striptags",
// "join",
// "reverse",
// "length",
// "sort",
// "default",
// "keys",
// "escape",
// "raw",
// "merge"
//};
private final static List<LookupElementBuilder> KEYWORD_LOOKUPS = new ArrayList<LookupElementBuilder>();
//private final static List<LookupElementBuilder> BUILT_IN_FILTER_LOOKUPS = new ArrayList<LookupElementBuilder>();
private final static List<LookupElementBuilder> FLAGS_LOOKUPS = new ArrayList<LookupElementBuilder>();
static {
for (String keyword : KEYWORDS) {
KEYWORD_LOOKUPS.add(LookupElementBuilder.create(keyword));
}
//for (String filter : BUILT_IN_FILTERS) {
// BUILT_IN_FILTER_LOOKUPS.add(LookupElementBuilder.create(filter));
//}
for (String flag : GetTextFlags.getAlFlags()) {
FLAGS_LOOKUPS.add(LookupElementBuilder.create(flag));
}
}
public GetTextCompletitionContributor() {
public GetTextCompletionContributor() {
extend(CompletionType.BASIC, psiElement().withParent(psiElement().withLanguage(GetTextLanguage.INSTANCE)),
new GetTextKeywordCompletionContributor());
}
@@ -73,17 +51,18 @@ public class GetTextCompletitionContributor extends CompletionContributor {
ProcessingContext context,
@NotNull CompletionResultSet result) {
final PsiElement currElement = parameters.getPosition().getOriginalElement();
if (currElement.getNode().getElementType() == GetTextTokenTypes.BAD_CHARACTER) {
PsiElement prevElement = currElement.getPrevSibling();
if (currElement.getNode().getElementType() == GetTextTokenTypes.COMMAND || prevElement instanceof PsiWhiteSpace) {
for (LookupElementBuilder builder : KEYWORD_LOOKUPS) result.addElement(builder);
result.stopHere();
//return;
return;
}
if (prevElement != null && GetTextTokenTypes.FLAG_LINE.contains(prevElement.getNode().getElementType())) {
for (LookupElementBuilder builder : FLAGS_LOOKUPS) result.addElement(builder);
result.stopHere();
}
//PsiElement prevElement = currElement.getPrevSibling();
//if (prevElement != null && prevElement instanceof PsiWhiteSpace) prevElement = prevElement.getPrevSibling();
//if (prevElement != null && prevElement.getNode().getElementType() == TwigTokenTypes.FILTER) {
// for (LookupElementBuilder builder : BUILT_IN_FILTER_LOOKUPS) result.addElement(builder);
// result.stopHere();
//}
}
}
}
@@ -0,0 +1,28 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.gettext.completion;
import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler;
import com.jetbrains.gettext.GetTextTokenTypes;
/**
* @author Svetlana.Zemlyanskaya
*/
public class GetTextQuoteHandler extends SimpleTokenSetQuoteHandler {
public GetTextQuoteHandler() {
super(GetTextTokenTypes.QUOTE);
}
}
@@ -1,6 +1,5 @@
package com.jetbrains.gettext.highlighter;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.SyntaxHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
@@ -25,9 +24,9 @@ public class GetTextHighlighterData {
public static final TextAttributesKey FLAG =
TextAttributesKey.createTextAttributesKey(FLAG_ID, SyntaxHighlighterColors.DOC_COMMENT_TAG.getDefaultAttributes().clone());
public static final String TRANSLATED_NUMBER_ID = "GET_TEXT_TRANSLATED_NUMBER";
public static final TextAttributesKey TRANSLATED_NUMBER =
TextAttributesKey.createTextAttributesKey(TRANSLATED_NUMBER_ID, SyntaxHighlighterColors.NUMBER.getDefaultAttributes().clone());
public static final String NUMBER_ID = "GET_TEXT_TRANSLATED_NUMBER";
public static final TextAttributesKey NUMBER =
TextAttributesKey.createTextAttributesKey(NUMBER_ID, SyntaxHighlighterColors.NUMBER.getDefaultAttributes().clone());
public static final String BRACES_ID = "GET_TEXT_BRACES";
public static final TextAttributesKey BRACES =
@@ -36,7 +35,4 @@ public class GetTextHighlighterData {
public static final String DOTS_ID = "GET_TEXT_DOTS";
public static final TextAttributesKey DOTS =
TextAttributesKey.createTextAttributesKey(DOTS_ID, SyntaxHighlighterColors.DOT.getDefaultAttributes().clone());
public static final TextAttributesKey BAD_CHARACTER =
TextAttributesKey.createTextAttributesKey("TS_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER.getDefaultAttributes());
}
@@ -3,7 +3,6 @@ package com.jetbrains.gettext.highlighter;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import com.jetbrains.gettext.GetTextLexer;
import com.jetbrains.gettext.GetTextTokenTypes;
@@ -34,9 +33,9 @@ public class GetTextSyntaxHighlighter extends SyntaxHighlighterBase {
fillMap(keys1, GetTextTokenTypes.KEYWORDS, GetTextHighlighterData.KEYWORD);
fillMap(keys1, GetTextTokenTypes.STRING_LITERALS, GetTextHighlighterData.STRING);
fillMap(keys1, GetTextTokenTypes.BRACES, GetTextHighlighterData.BRACES);
keys1.put(GetTextTokenTypes.NUMBER, GetTextHighlighterData.TRANSLATED_NUMBER);
fillMap(keys1, GetTextTokenTypes.NUMBERS, GetTextHighlighterData.NUMBER);
keys1.put(GetTextTokenTypes.DOTS, GetTextHighlighterData.DOTS);
keys1.put(TokenType.BAD_CHARACTER, GetTextHighlighterData.BAD_CHARACTER);
keys1.put(GetTextTokenTypes.BAD_CHARACTER, GetTextHighlighterData.KEYWORD);
}
@@ -1,11 +0,0 @@
package com.jetbrains.gettext.lang;
/**
* @author Svetlana.Zemlyanskaya
*/
public class CommandFormatException extends Exception {
public CommandFormatException(String message) {
super(message);
}
}
@@ -0,0 +1,86 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.gettext.lang;
import java.util.ArrayList;
import java.util.List;
/**
* @author Svetlana.Zemlyanskaya
*/
public enum GetTextFlags {
FUZZY("fuzzy", false),
RANGE("range", false),
C("c"),
OBJC("objc"),
SH("sh"),
PYTHON("python"),
LISP("lisp"),
ELISP("elisp"),
LIBREP("librep"),
SCHEME("scheme"),
SMALLTALK("smalltalk"),
JAVA("java"),
CSHARP("csharp"),
AWK("awk"),
YCP("ycp"),
TCL("tcl"),
PERL("perl-brace"),
PHP("php"),
GCC("gcc-internal"),
GFC("gfc-internal"),
QT("qt"),
KDE("kde"),
BOOST("boost"),
PASCAL("object-pascal"),
QT_PURAL("qt-plural");
private String flagContent;
private boolean isFormatFlag;
GetTextFlags(String flagContent, boolean formatFlag) {
this.flagContent = flagContent;
isFormatFlag = formatFlag;
}
GetTextFlags(String flagContent) {
this.flagContent = flagContent;
this.isFormatFlag = true;
}
public static List<String> getAlFlags() {
List<String> flags = new ArrayList<String>();
for (GetTextFlags flag : GetTextFlags.values()) {
if (flag.isFormatFlag) {
flags.add(constructFormatFlag(flag.flagContent));
flags.add(constructNoFormatFlag(flag.flagContent));
} else {
flags.add(flag.flagContent);
}
}
return flags;
}
private static String constructFormatFlag(String formatContent) {
return formatContent + "-format";
}
private static String constructNoFormatFlag(String formatContent) {
return "no-" + constructFormatFlag(formatContent);
}
}
@@ -13,16 +13,14 @@ public abstract class MsgCommand {
public abstract IElementType getCompositeElement();
public void parse(PsiBuilder builder) throws CommandFormatException {
public boolean parse(PsiBuilder builder) {
builder.advanceLexer();
int count = 0;
while (builder.getTokenType() == GetTextTokenTypes.STRING) {
checkString(builder);
count++;
}
if (count == 0) {
throw new CommandFormatException("String for " + getName() + " is not specified");
}
return count > 0;
}
private static void checkString(PsiBuilder builder) {
@@ -54,15 +52,8 @@ public abstract class MsgCommand {
exists = true;
return true;
}
else if (isMultiple()) {
return true;
}
return false;
return isMultiple();
}
public abstract String getName();
public int getCount() {
return exists ? 1 : 0;
}
}
@@ -45,17 +45,16 @@ public class MsgCommandContainer {
PsiBuilder.Marker marker = builder.mark();
try {
MsgCommand command = getCommand(builder.getTokenType());
command.parse(builder);
//if (result) {
boolean result = command.parse(builder);
if (result) {
marker.done(command.getCompositeElement());
//}
//else {
// marker.error("String for " + command.getName() + " is not specified");
//}
//return result;
return true;
}
else {
marker.error("String for " + command.getName() + " is not specified");
}
return result;
}
catch (Exception e) {
catch (UnknownCommandException e) {
marker.error(e.getMessage());
builder.advanceLexer();
return false;
@@ -10,10 +10,7 @@ import com.jetbrains.gettext.GetTextTokenTypes;
*/
public class MsgstrCommand extends MsgCommand {
private int count;
public MsgstrCommand() {
count = 0;
}
@Override
@@ -22,29 +19,35 @@ public class MsgstrCommand extends MsgCommand {
}
@Override
public void parse(PsiBuilder builder) throws CommandFormatException {
try {
super.parse(builder);
}
catch (CommandFormatException e) {
parseBraces(builder);
}
//return super.parse(builder) || parseBraces(builder);
public boolean parse(PsiBuilder builder) {
return super.parse(builder) || parseBraces(builder);
}
private boolean parseBraces(PsiBuilder builder) throws CommandFormatException {
private boolean parseBraces(PsiBuilder builder) {
if (builder.getTokenType() == GetTextTokenTypes.LBRACE) {
builder.advanceLexer();
if (builder.getTokenType() == GetTextTokenTypes.NUMBER) {
builder.advanceLexer();
if (!checkNumber(builder)) {
PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
marker.error("Wrong number format");
}
else {
builder.advanceLexer();
}
if (builder.getTokenType() == GetTextTokenTypes.RBRACE) {
super.parse(builder);
return super.parse(builder);
}
}
}
return false;
}
private static boolean checkNumber(PsiBuilder builder) {
String number = builder.getTokenText();
return number != null && !number.isEmpty() && !(number.charAt(0) == '0' && !number.equals("0"));
}
@Override
public boolean isNecessary() {
return true;
@@ -59,18 +62,4 @@ public class MsgstrCommand extends MsgCommand {
public String getName() {
return "msgstr";
}
@Override
public int getCount() {
return count;
}
@Override
public boolean register() {
boolean result = super.register();
if (result) {
count++;
}
return result;
}
}
@@ -36,7 +36,7 @@ public class GetTextParser implements PsiParser {
private static void parseCommentHeader(PsiBuilder builder) {
PsiBuilder.Marker marker = builder.mark();
while (GetTextTokenTypes.COMMENTS.contains(builder.getTokenType()) ||
GetTextTokenTypes.FLAGS.contains(builder.getTokenType())) {
GetTextTokenTypes.FLAG_LINE.contains(builder.getTokenType())) {
builder.advanceLexer();
}
marker.done(GetTextCompositeElementTypes.HEADER);
@@ -48,8 +48,8 @@ public class GetTextParser implements PsiParser {
while (!canTerminate(builder, container)) {
try {
IElementType token = builder.getTokenType();
if (container.parse(builder)) {
container.addCommand(token);
if (container.parse(builder) && !container.addCommand(token)) {
break;
}
}
catch (UnknownCommandException e) {
@@ -35,10 +35,9 @@ public class GetTextLexerTest extends UsefulTestCase {
}
private static void doTest(String fileName) throws IOException {
final String fullPath = GetTextUtils.getFullPath(fileName);
final Lexer lexer = new GetTextLexer();
final String testText = getFileText(fullPath + ".po");
final String expected = fullPath + ".txt";
final String testText = getFileText(GetTextUtils.getFullSourcePath(fileName));
final String expected = GetTextUtils.getFullLexerPath(fileName);
doFileLexerTest(lexer, testText, expected);
}
@@ -53,7 +52,7 @@ public class GetTextLexerTest extends UsefulTestCase {
}
public void testLexer() throws Throwable {
doTest("string");
doTest("command_format");
}
public void testAllFiles() throws Throwable {
@@ -16,7 +16,7 @@ import java.io.IOException;
public class GetTextParserTest extends LightCodeInsightFixtureTestCase {
private void doTest(String fileName) throws IOException {
final String filePath = GetTextUtils.getFullPath(fileName) + ".po";
final String filePath = GetTextUtils.getFullSourcePath(fileName);
try {
final String fileText = FileUtil.loadFile(new File(filePath));
@@ -30,17 +30,16 @@ public class GetTextParserTest extends LightCodeInsightFixtureTestCase {
private void doTest(@NonNls final String code, final String fileName) {
final PsiFile psiFile = createLightFile(fileName, GetTextLanguage.INSTANCE, code);
final String tree = DebugUtil.psiTreeToString(psiFile, false);
final String path = GetTextUtils.getFullParserResultPath(fileName);
final String path = GetTextUtils.getFullParserPath(fileName);
assertSameLinesWithFile(path, tree);
}
public void testSimple() throws IOException {
doTest("string");
doTest("command");
}
public void testAllFiles() throws Throwable {
for(final String file : GetTextUtils.getAllTestedFiles()) {
System.out.println("Start: " + file);
doTest(file);
}
}
@@ -6,6 +6,7 @@ import com.intellij.openapi.application.PathManager;
* @author Svetlana.Zemlyanskaya
*/
public class GetTextUtils {
private static final String path = "community/plugins/gettext/test/com/jetbrains/gettext/";
public static String[] getAllTestedFiles() {
return new String[]{
@@ -15,18 +16,25 @@ public class GetTextUtils {
"complex_flags",
"msg_plural",
"range_flag",
"string"};
"string",
"command_format",
"multi_id",
"command"};
}
protected static String getDataSubpath() {
return "community/plugins/gettext/test/com/jetbrains/gettext/lexer";
private static String getFullPath() {
return PathManager.getHomePath() + "/" + path;
}
public static String getFullPath(final String fileName) {
return PathManager.getHomePath() + "/" + getDataSubpath() + "/" + fileName;
public static String getFullSourcePath(final String fileName) {
return getFullPath() + "lexer/" + fileName + ".po";
}
public static String getFullParserResultPath(final String fileName) {
return getFullPath(fileName) + "_parser.txt";
public static String getFullLexerPath(final String fileName) {
return getFullPath() + "lexer/" + fileName + ".txt";
}
public static String getFullParserPath(final String fileName) {
return getFullPath() + "parser/" + fileName + ".txt";
}
}
@@ -0,0 +1 @@
msg
@@ -0,0 +1 @@
COMMAND ('msg')
@@ -0,0 +1,2 @@
msgid ""
msgstr
@@ -0,0 +1,6 @@
MSGID ('msgid')
WHITE_SPACE (' ')
STRING ('""')
WHITE_SPACE ('
')
MSGSTR ('msgstr')
@@ -4,24 +4,22 @@ COMMENT ('test')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (',')
WHITE_SPACE (' ')
FLAG_COMMENT (',')
DELIVERY (' ')
FUZZY_FLAG ('fuzzy')
DELIVERY (',')
WHITE_SPACE (' ')
DELIVERY (' ')
FORMAT_FLAG ('c-format')
DELIVERY (',')
WHITE_SPACE (' ')
DELIVERY (' ')
NO_FORMAT_FLAG ('no-objc-format')
WHITE_SPACE ('
')
@@ -4,18 +4,16 @@ COMMENT ('test')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (',')
WHITE_SPACE (' ')
FLAG_COMMENT (',')
DELIVERY (' ')
FUZZY_FLAG ('fuzzy')
DELIVERY (',')
WHITE_SPACE ('
@@ -4,18 +4,15 @@ COMMENT ('test')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('|')
PREVIOUS_TRANSLATE_COMMENT (' msgid test')
PREVIOUS_TRANSLATE_COMMENT ('| msgid test')
WHITE_SPACE ('
')
MSGID_PLURAL ('msgid_plural')
@@ -0,0 +1,7 @@
msgid ""
msgstr ""
msgid ""
msgid ""
msgstr ""
@@ -0,0 +1,27 @@
MSGID ('msgid')
WHITE_SPACE (' ')
STRING ('""')
WHITE_SPACE ('
')
MSGSTR ('msgstr')
WHITE_SPACE (' ')
STRING ('""')
WHITE_SPACE ('
')
WHITE_SPACE ('
')
MSGID ('msgid')
WHITE_SPACE (' ')
STRING ('""')
WHITE_SPACE ('
')
WHITE_SPACE ('
')
MSGID ('msgid')
WHITE_SPACE (' ')
STRING ('""')
WHITE_SPACE ('
')
MSGSTR ('msgstr')
WHITE_SPACE (' ')
STRING ('""')
@@ -4,27 +4,25 @@ COMMENT ('test')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (',')
WHITE_SPACE (' ')
FLAG_COMMENT (',')
DELIVERY (' ')
FUZZY_FLAG ('fuzzy')
DELIVERY (',')
WHITE_SPACE (' ')
DELIVERY (' ')
RANGE_FLAG ('range')
COLON (':')
WHITE_SPACE (' ')
NUMBER ('0')
DELIVERY (' ')
RANGE_NUMBER ('0')
DOTS ('..')
NUMBER ('10')
RANGE_NUMBER ('10')
WHITE_SPACE ('
')
MSGID ('msgid')
@@ -4,18 +4,15 @@ COMMENT ('test')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('|')
PREVIOUS_TRANSLATE_COMMENT (' msgid test')
PREVIOUS_TRANSLATE_COMMENT ('| msgid test')
WHITE_SPACE ('
')
MSGID ('msgid')
@@ -36,18 +33,15 @@ COMMENT ('t')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('.')
EXTR_COMMENT (' another')
EXTR_COMMENT ('. another')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS (':')
REFERENCE (' ref')
REFERENCE (': ref')
WHITE_SPACE ('
')
COMMENT_SYMBOLS ('#')
COMMENT_SYMBOLS ('|')
PREVIOUS_TRANSLATE_COMMENT (' msgid test')
PREVIOUS_TRANSLATE_COMMENT ('| msgid test')
WHITE_SPACE ('
')
MSGID ('msgid')
@@ -0,0 +1,8 @@
GNU GetText File
MSG_BLOCK
HEADER
<empty list>
PsiErrorElement:Not enough commands
PsiErrorElement:Unexpected token
<empty list>
PsiElement(COMMAND)('msg')
@@ -0,0 +1,12 @@
GNU GetText File
MSG_BLOCK
HEADER
<empty list>
PsiErrorElement:Not enough commands
MSGID
PsiElement(MSGID)('msgid')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
PsiWhiteSpace('\n')
PsiErrorElement:String for msgstr is not specified
PsiElement(MSGSTR)('msgstr')
@@ -4,24 +4,22 @@ GNU GetText File
PsiComment(COMMENT)('test')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(',')
PsiWhiteSpace(' ')
PsiElement(FLAG_COMMENT)(',')
PsiElement(DELIVERY)(' ')
PsiElement(FUZZY_FLAG)('fuzzy')
PsiElement(DELIVERY)(',')
PsiWhiteSpace(' ')
PsiElement(DELIVERY)(' ')
PsiElement(FORMAT_FLAG)('c-format')
PsiElement(DELIVERY)(',')
PsiWhiteSpace(' ')
PsiElement(DELIVERY)(' ')
PsiElement(NO_FORMAT_FLAG)('no-objc-format')
PsiWhiteSpace('\n')
MSG_CONTENT
@@ -4,18 +4,16 @@ GNU GetText File
PsiComment(COMMENT)('test')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(',')
PsiWhiteSpace(' ')
PsiElement(FLAG_COMMENT)(',')
PsiElement(DELIVERY)(' ')
PsiElement(FUZZY_FLAG)('fuzzy')
PsiElement(DELIVERY)(',')
PsiWhiteSpace('\n')
@@ -4,18 +4,15 @@ GNU GetText File
PsiComment(COMMENT)('test')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('|')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)(' msgid test')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)('| msgid test')
PsiWhiteSpace('\n')
MSG_CONTENT
MSGID_PLURAL
@@ -39,7 +36,8 @@ GNU GetText File
MSGSTR
PsiElement(MSGSTR)('msgstr')
PsiElement(LBRACE)('[')
PsiElement(NUMBER)('01')
PsiErrorElement:Wrong number format
PsiElement(NUMBER)('01')
PsiElement(RBRACE)(']')
PsiWhiteSpace(' ')
PsiElement(STRING)('"translated string"')
@@ -0,0 +1,39 @@
GNU GetText File
MSG_BLOCK
HEADER
<empty list>
MSG_CONTENT
MSGID
PsiElement(MSGID)('msgid')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
PsiWhiteSpace('\n')
MSGSTR
PsiElement(MSGSTR)('msgstr')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
MSG_BLOCK
HEADER
<empty list>
PsiErrorElement:Not enough commands
MSGID
PsiElement(MSGID)('msgid')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
PsiWhiteSpace('\n')
PsiWhiteSpace('\n')
MSGID
PsiElement(MSGID)('msgid')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
PsiWhiteSpace('\n')
MSG_BLOCK
HEADER
<empty list>
PsiErrorElement:Not enough commands
MSGSTR
PsiElement(MSGSTR)('msgstr')
PsiWhiteSpace(' ')
PsiElement(STRING)('""')
@@ -4,37 +4,27 @@ GNU GetText File
PsiComment(COMMENT)('test')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(',')
PsiWhiteSpace(' ')
PsiElement(FLAG_COMMENT)(',')
PsiElement(DELIVERY)(' ')
PsiElement(FUZZY_FLAG)('fuzzy')
PsiElement(DELIVERY)(',')
PsiWhiteSpace(' ')
PsiElement(DELIVERY)(' ')
PsiElement(RANGE_FLAG)('range')
MSG_CONTENT
PsiErrorElement:Unexpected token
<empty list>
PsiElement(COLON)(':')
PsiErrorElement:Unexpected token
<empty list>
PsiWhiteSpace(' ')
PsiElement(NUMBER)('0')
PsiErrorElement:Unexpected token
<empty list>
PsiElement(DELIVERY)(' ')
PsiElement(RANGE_NUMBER)('0')
PsiElement(DOTS)('..')
PsiErrorElement:Unexpected token
<empty list>
PsiElement(NUMBER)('10')
PsiWhiteSpace('\n')
PsiElement(RANGE_NUMBER)('10')
PsiWhiteSpace('\n')
MSG_CONTENT
MSGID
PsiElement(MSGID)('msgid')
PsiWhiteSpace(' ')
@@ -4,18 +4,15 @@ GNU GetText File
PsiComment(COMMENT)('test')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('|')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)(' msgid test')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)('| msgid test')
PsiWhiteSpace('\n')
MSG_CONTENT
MSGID
@@ -34,18 +31,15 @@ GNU GetText File
PsiComment(COMMENT)('t')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('.')
MSG_BLOCK
HEADER
PsiElement(EXTR_COMMENT)(' another')
PsiElement(EXTR_COMMENT)('. another')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)(':')
PsiElement(REFERENCE)(' ref')
PsiElement(REFERENCE)(': ref')
PsiWhiteSpace('\n')
PsiComment(COMMENT_SYMBOLS)('#')
PsiComment(COMMENT_SYMBOLS)('|')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)(' msgid test')
PsiElement(PREVIOUS_TRANSLATE_COMMENT)('| msgid test')
PsiWhiteSpace('\n')
MSG_CONTENT
MSGID