From 6bcf8623e57f8a05681d3edbcc9cc8412ebeef5e Mon Sep 17 00:00:00 2001 From: cheptsov Date: Thu, 3 Nov 2016 16:45:34 +0100 Subject: [PATCH] IJSDK-203 Confusing grammar and no info on comments and whitespaces --- .../com/simpleplugin/parser/SimpleParser.java | 89 ++++++++++++------- .../com/simpleplugin/psi/SimpleProperty.java | 4 +- .../gen/com/simpleplugin/psi/SimpleTypes.java | 9 +- .../com/simpleplugin/psi/SimpleVisitor.java | 5 +- .../psi/impl/SimplePropertyImpl.java | 16 +++- .../simpleplugin/CreatePropertyQuickFix.java | 17 ++-- .../src/com/simpleplugin/Simple.bnf | 13 ++- .../src/com/simpleplugin/Simple.flex | 10 +-- .../src/com/simpleplugin/SimpleBlock.java | 3 +- .../src/com/simpleplugin/SimpleLexer.java | 73 +++++++-------- .../testData/ParsingTestData.txt | 51 ++++++----- 11 files changed, 167 insertions(+), 123 deletions(-) diff --git a/simple_language_plugin/gen/com/simpleplugin/parser/SimpleParser.java b/simple_language_plugin/gen/com/simpleplugin/parser/SimpleParser.java index fe0c12d4e..c4652d819 100644 --- a/simple_language_plugin/gen/com/simpleplugin/parser/SimpleParser.java +++ b/simple_language_plugin/gen/com/simpleplugin/parser/SimpleParser.java @@ -1,12 +1,15 @@ // This is a generated file. Not intended for manual editing. package com.simpleplugin.parser; -import com.intellij.lang.*; +import com.intellij.lang.PsiBuilder; import com.intellij.lang.PsiBuilder.Marker; -import com.intellij.psi.tree.IElementType; - -import static com.intellij.lang.parser.GeneratedParserUtilBase.*; import static com.simpleplugin.psi.SimpleTypes.*; +import static com.intellij.lang.parser.GeneratedParserUtilBase.*; +import com.intellij.psi.tree.IElementType; +import com.intellij.lang.ASTNode; +import com.intellij.psi.tree.TokenSet; +import com.intellij.lang.PsiParser; +import com.intellij.lang.LightPsiParser; @SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"}) public class SimpleParser implements PsiParser, LightPsiParser { @@ -22,7 +25,8 @@ public class SimpleParser implements PsiParser, LightPsiParser { Marker m = enter_section_(b, 0, _COLLAPSE_, null); if (t == PROPERTY) { r = property(b, 0); - } else { + } + else { r = parse_root_(t, b, 0); } exit_section_(b, 0, m, t, r, true, TRUE_CONDITION); @@ -33,50 +37,28 @@ public class SimpleParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // property|COMMENT|CRLF - static boolean item_(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "item_")) return false; - boolean r; - Marker m = enter_section_(b); - r = property(b, l + 1); - if (!r) r = consumeToken(b, COMMENT); - if (!r) r = consumeToken(b, CRLF); - exit_section_(b, m, null, r); - return r; - } - - /* ********************************************************** */ - // (KEY? SEPARATOR VALUE?) | KEY + // (KEY SEPARATOR VALUE?)|KEY public static boolean property(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "property")) return false; - if (!nextTokenIs(b, "", KEY, SEPARATOR)) return false; boolean r; - Marker m = enter_section_(b, l, _NONE_, ""); + Marker m = enter_section_(b, l, _NONE_, PROPERTY, ""); r = property_0(b, l + 1); if (!r) r = consumeToken(b, KEY); - exit_section_(b, l, m, PROPERTY, r, false, null); + exit_section_(b, l, m, r, false, recover_property_parser_); return r; } - // KEY? SEPARATOR VALUE? + // KEY SEPARATOR VALUE? private static boolean property_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "property_0")) return false; boolean r; Marker m = enter_section_(b); - r = property_0_0(b, l + 1); - r = r && consumeToken(b, SEPARATOR); + r = consumeTokens(b, 0, KEY, SEPARATOR); r = r && property_0_2(b, l + 1); exit_section_(b, m, null, r); return r; } - // KEY? - private static boolean property_0_0(PsiBuilder b, int l) { - if (!recursion_guard_(b, l, "property_0_0")) return false; - consumeToken(b, KEY); - return true; - } - // VALUE? private static boolean property_0_2(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "property_0_2")) return false; @@ -85,16 +67,55 @@ public class SimpleParser implements PsiParser, LightPsiParser { } /* ********************************************************** */ - // item_* + // !(KEY|SEPARATOR|COMMENT) + static boolean recover_property(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "recover_property")) return false; + boolean r; + Marker m = enter_section_(b, l, _NOT_); + r = !recover_property_0(b, l + 1); + exit_section_(b, l, m, r, false, null); + return r; + } + + // KEY|SEPARATOR|COMMENT + private static boolean recover_property_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "recover_property_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = consumeToken(b, KEY); + if (!r) r = consumeToken(b, SEPARATOR); + if (!r) r = consumeToken(b, COMMENT); + exit_section_(b, m, null, r); + return r; + } + + /* ********************************************************** */ + // (property|COMMENT)* static boolean simpleFile(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "simpleFile")) return false; int c = current_position_(b); while (true) { - if (!item_(b, l + 1)) break; + if (!simpleFile_0(b, l + 1)) break; if (!empty_element_parsed_guard_(b, "simpleFile", c)) break; c = current_position_(b); } return true; } + // property|COMMENT + private static boolean simpleFile_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "simpleFile_0")) return false; + boolean r; + Marker m = enter_section_(b); + r = property(b, l + 1); + if (!r) r = consumeToken(b, COMMENT); + exit_section_(b, m, null, r); + return r; + } + + final static Parser recover_property_parser_ = new Parser() { + public boolean parse(PsiBuilder b, int l) { + return recover_property(b, l + 1); + } + }; } diff --git a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleProperty.java b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleProperty.java index 3070e4a78..2ff5df042 100644 --- a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleProperty.java +++ b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleProperty.java @@ -1,8 +1,10 @@ // This is a generated file. Not intended for manual editing. package com.simpleplugin.psi; -import com.intellij.navigation.ItemPresentation; +import java.util.List; +import org.jetbrains.annotations.*; import com.intellij.psi.PsiElement; +import com.intellij.navigation.ItemPresentation; public interface SimpleProperty extends SimpleNamedElement { diff --git a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleTypes.java b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleTypes.java index 5c7afd50e..4e0333e72 100644 --- a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleTypes.java +++ b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleTypes.java @@ -1,17 +1,16 @@ // This is a generated file. Not intended for manual editing. package com.simpleplugin.psi; -import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; -import com.simpleplugin.psi.impl.SimplePropertyImpl; +import com.intellij.psi.PsiElement; +import com.intellij.lang.ASTNode; +import com.simpleplugin.psi.impl.*; public interface SimpleTypes { IElementType PROPERTY = new SimpleElementType("PROPERTY"); IElementType COMMENT = new SimpleTokenType("COMMENT"); - IElementType CRLF = new SimpleTokenType("CRLF"); IElementType KEY = new SimpleTokenType("KEY"); IElementType SEPARATOR = new SimpleTokenType("SEPARATOR"); IElementType VALUE = new SimpleTokenType("VALUE"); @@ -19,7 +18,7 @@ public interface SimpleTypes { class Factory { public static PsiElement createElement(ASTNode node) { IElementType type = node.getElementType(); - if (type == PROPERTY) { + if (type == PROPERTY) { return new SimplePropertyImpl(node); } throw new AssertionError("Unknown element type: " + type); diff --git a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleVisitor.java b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleVisitor.java index 950476ed5..504829968 100644 --- a/simple_language_plugin/gen/com/simpleplugin/psi/SimpleVisitor.java +++ b/simple_language_plugin/gen/com/simpleplugin/psi/SimpleVisitor.java @@ -1,8 +1,9 @@ // This is a generated file. Not intended for manual editing. package com.simpleplugin.psi; -import com.intellij.psi.*; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.*; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.PsiElement; public class SimpleVisitor extends PsiElementVisitor { diff --git a/simple_language_plugin/gen/com/simpleplugin/psi/impl/SimplePropertyImpl.java b/simple_language_plugin/gen/com/simpleplugin/psi/impl/SimplePropertyImpl.java index ef4754ccd..2c23adbf6 100644 --- a/simple_language_plugin/gen/com/simpleplugin/psi/impl/SimplePropertyImpl.java +++ b/simple_language_plugin/gen/com/simpleplugin/psi/impl/SimplePropertyImpl.java @@ -1,11 +1,15 @@ // This is a generated file. Not intended for manual editing. package com.simpleplugin.psi.impl; +import java.util.List; +import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; -import com.intellij.navigation.ItemPresentation; -import com.intellij.psi.*; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.util.PsiTreeUtil; +import static com.simpleplugin.psi.SimpleTypes.*; import com.simpleplugin.psi.*; -import org.jetbrains.annotations.NotNull; +import com.intellij.navigation.ItemPresentation; public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty { @@ -13,8 +17,12 @@ public class SimplePropertyImpl extends SimpleNamedElementImpl implements Simple super(node); } + public void accept(@NotNull SimpleVisitor visitor) { + visitor.visitProperty(this); + } + public void accept(@NotNull PsiElementVisitor visitor) { - if (visitor instanceof SimpleVisitor) ((SimpleVisitor) visitor).visitProperty(this); + if (visitor instanceof SimpleVisitor) accept((SimpleVisitor)visitor); else super.accept(visitor); } diff --git a/simple_language_plugin/src/com/simpleplugin/CreatePropertyQuickFix.java b/simple_language_plugin/src/com/simpleplugin/CreatePropertyQuickFix.java index 8cb080550..815c47178 100644 --- a/simple_language_plugin/src/com/simpleplugin/CreatePropertyQuickFix.java +++ b/simple_language_plugin/src/com/simpleplugin/CreatePropertyQuickFix.java @@ -5,16 +5,22 @@ import com.intellij.lang.ASTNode; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.fileChooser.*; +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; +import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.Navigatable; -import com.intellij.psi.*; -import com.intellij.psi.search.*; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiManager; +import com.intellij.psi.search.FileTypeIndex; +import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.IncorrectOperationException; import com.intellij.util.indexing.FileBasedIndex; -import com.simpleplugin.psi.*; +import com.simpleplugin.psi.SimpleElementFactory; +import com.simpleplugin.psi.SimpleFile; +import com.simpleplugin.psi.SimpleProperty; import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -73,7 +79,8 @@ class CreatePropertyQuickFix extends BaseIntentionAction { public void run() { SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(file); ASTNode lastChildNode = simpleFile.getNode().getLastChildNode(); - if (lastChildNode != null && !lastChildNode.getElementType().equals(SimpleTypes.CRLF)) { + // TODO: Add another check for CRLF + if (lastChildNode != null/* && !lastChildNode.getElementType().equals(SimpleTypes.CRLF)*/) { simpleFile.getNode().addChild(SimpleElementFactory.createCRLF(project).getNode()); } // IMPORTANT: change spaces to escaped spaces or the new node will only have the first word for the key diff --git a/simple_language_plugin/src/com/simpleplugin/Simple.bnf b/simple_language_plugin/src/com/simpleplugin/Simple.bnf index d5ca3cef2..6aef4bb6e 100644 --- a/simple_language_plugin/src/com/simpleplugin/Simple.bnf +++ b/simple_language_plugin/src/com/simpleplugin/Simple.bnf @@ -15,9 +15,14 @@ psiImplUtilClass="com.simpleplugin.psi.impl.SimplePsiImplUtil" } -simpleFile ::= item_* +simpleFile ::= (property|COMMENT)* -private item_ ::= (property|COMMENT|CRLF) +property ::= (KEY SEPARATOR VALUE?)|KEY { + pin=3 + recoverWhile="recover_property" + mixin="com.simpleplugin.psi.impl.SimpleNamedElementImpl" + implements="com.simpleplugin.psi.SimpleNamedElement" + methods=[getKey getValue getName setName getNameIdentifier getPresentation] +} -property ::= (KEY? SEPARATOR VALUE?) | KEY {mixin="com.simpleplugin.psi.impl.SimpleNamedElementImpl" - implements="com.simpleplugin.psi.SimpleNamedElement" methods=[getKey getValue getName setName getNameIdentifier getPresentation]} \ No newline at end of file +private recover_property ::= !(KEY|SEPARATOR|COMMENT) \ No newline at end of file diff --git a/simple_language_plugin/src/com/simpleplugin/Simple.flex b/simple_language_plugin/src/com/simpleplugin/Simple.flex index 0c505eb80..e63022e88 100644 --- a/simple_language_plugin/src/com/simpleplugin/Simple.flex +++ b/simple_language_plugin/src/com/simpleplugin/Simple.flex @@ -15,11 +15,11 @@ import com.intellij.psi.TokenType; %eof{ return; %eof} -CRLF=\n -WHITE_SPACE=[\ \t\f] +CRLF=\R +WHITE_SPACE=[\ \n\t\f] FIRST_VALUE_CHARACTER=[^ \n\f\\] | "\\"{CRLF} | "\\". VALUE_CHARACTER=[^\n\f\\] | "\\"{CRLF} | "\\". -END_OF_LINE_COMMENT=("#"|"!")[^\n]* +END_OF_LINE_COMMENT=("#"|"!")[^\r\n]* SEPARATOR=[:=] KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ " @@ -39,8 +39,6 @@ KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ " {FIRST_VALUE_CHARACTER}{VALUE_CHARACTER}* { yybegin(YYINITIAL); return SimpleTypes.VALUE; } -{CRLF}+ { yybegin(YYINITIAL); return SimpleTypes.CRLF; } - -{WHITE_SPACE}+ { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; } +({CRLF}|{WHITE_SPACE})+ { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; } . { return TokenType.BAD_CHARACTER; } diff --git a/simple_language_plugin/src/com/simpleplugin/SimpleBlock.java b/simple_language_plugin/src/com/simpleplugin/SimpleBlock.java index 0a1b60964..8ea1b008e 100644 --- a/simple_language_plugin/src/com/simpleplugin/SimpleBlock.java +++ b/simple_language_plugin/src/com/simpleplugin/SimpleBlock.java @@ -4,7 +4,6 @@ import com.intellij.formatting.*; import com.intellij.lang.ASTNode; import com.intellij.psi.TokenType; import com.intellij.psi.formatter.common.AbstractBlock; -import com.simpleplugin.psi.SimpleTypes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,7 +24,7 @@ public class SimpleBlock extends AbstractBlock { List blocks = new ArrayList(); ASTNode child = myNode.getFirstChildNode(); while (child != null) { - if (child.getElementType() != TokenType.WHITE_SPACE && child.getElementType() != SimpleTypes.CRLF) { + if (child.getElementType() != TokenType.WHITE_SPACE) { Block block = new SimpleBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), spacingBuilder); blocks.add(block); diff --git a/simple_language_plugin/src/com/simpleplugin/SimpleLexer.java b/simple_language_plugin/src/com/simpleplugin/SimpleLexer.java index ec6c4d894..ecb7f5142 100644 --- a/simple_language_plugin/src/com/simpleplugin/SimpleLexer.java +++ b/simple_language_plugin/src/com/simpleplugin/SimpleLexer.java @@ -54,8 +54,8 @@ class SimpleLexer implements FlexLexer { /* The ZZ_CMAP_A table has 320 entries */ static final char ZZ_CMAP_A[] = zzUnpackCMap( - "\11\0\1\2\1\1\1\5\1\6\1\5\22\0\1\4\1\7\1\0\1\7\26\0\1\10\2\0\1\10\36\0\1\3"+ - "\50\0\1\5\242\0\2\5\26\0"); + "\11\0\1\4\1\2\1\1\1\5\1\3\22\0\1\7\1\10\1\0\1\10\26\0\1\11\2\0\1\11\36\0\1"+ + "\6\50\0\1\1\242\0\2\1\26\0"); /** * Translates DFA states to action switch labels. @@ -63,11 +63,11 @@ class SimpleLexer implements FlexLexer { private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = - "\2\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ - "\1\2\1\10\1\4\1\10\2\0\1\3"; + "\2\0\2\1\1\2\1\3\1\4\1\5\2\6\2\7"+ + "\1\3\1\7\1\0\2\4\1\0\1\2\2\6"; private static int [] zzUnpackAction() { - int [] result = new int[16]; + int [] result = new int[21]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -92,11 +92,12 @@ class SimpleLexer implements FlexLexer { private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\11\0\22\0\33\0\44\0\55\0\66\0\77"+ - "\0\110\0\121\0\132\0\143\0\154\0\55\0\143\0\121"; + "\0\0\0\12\0\24\0\36\0\50\0\62\0\74\0\106"+ + "\0\120\0\132\0\50\0\144\0\156\0\170\0\62\0\202"+ + "\0\214\0\156\0\132\0\226\0\240"; private static int [] zzUnpackRowMap() { - int [] result = new int[16]; + int [] result = new int[21]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -119,18 +120,22 @@ class SimpleLexer implements FlexLexer { private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = - "\1\3\1\4\1\5\1\6\1\5\1\3\1\5\1\7"+ - "\1\10\1\11\1\12\1\13\1\14\1\15\1\11\1\15"+ - "\2\11\1\3\2\0\1\16\1\0\1\3\1\0\1\3"+ - "\2\0\1\4\11\0\1\5\1\0\1\5\1\0\1\5"+ - "\6\0\1\3\4\0\1\7\1\0\7\7\11\0\1\11"+ - "\1\0\1\11\1\17\2\11\1\0\2\11\1\0\2\20"+ - "\1\0\1\20\1\0\1\20\2\0\1\11\1\0\1\13"+ - "\1\17\1\13\1\11\1\15\7\11\2\0\2\11\2\0"+ - "\1\15\1\0\1\15\1\0\1\15\2\0"; + "\1\3\1\4\1\5\1\4\2\5\1\6\1\5\1\7"+ + "\1\10\1\11\1\12\1\13\1\12\1\14\1\13\1\15"+ + "\1\16\2\11\2\3\1\0\1\3\2\0\1\17\1\0"+ + "\1\3\1\0\1\3\1\4\1\5\1\4\2\5\1\17"+ + "\1\5\1\3\2\0\5\5\1\0\1\5\11\0\1\3"+ + "\2\0\2\7\1\0\1\3\2\20\1\21\1\20\1\7"+ + "\1\20\12\0\2\11\1\0\2\11\1\0\1\22\4\11"+ + "\1\23\1\5\2\23\1\5\1\22\1\23\3\11\1\24"+ + "\1\16\1\24\1\14\1\16\1\22\1\14\5\11\1\25"+ + "\6\11\1\0\1\5\1\16\1\5\2\16\1\0\1\16"+ + "\2\0\2\20\2\0\10\20\2\0\3\20\1\7\2\20"+ + "\1\11\1\24\1\5\2\24\1\5\1\22\1\24\7\11"+ + "\1\0\1\22\3\11"; private static int [] zzUnpackTrans() { - int [] result = new int[117]; + int [] result = new int[170]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -168,10 +173,10 @@ class SimpleLexer implements FlexLexer { private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\2\0\5\1\1\11\5\1\2\0\1\1"; + "\2\0\5\1\1\11\6\1\1\0\2\1\1\0\3\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[16]; + int [] result = new int[21]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -487,35 +492,31 @@ class SimpleLexer implements FlexLexer { case 1: { yybegin(YYINITIAL); return SimpleTypes.KEY; } - case 9: break; + case 8: break; case 2: - { yybegin(YYINITIAL); return SimpleTypes.CRLF; - } - case 10: break; - case 3: { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; } - case 11: break; - case 4: + case 9: break; + case 3: { return TokenType.BAD_CHARACTER; } - case 12: break; - case 5: + case 10: break; + case 4: { yybegin(YYINITIAL); return SimpleTypes.COMMENT; } - case 13: break; - case 6: + case 11: break; + case 5: { yybegin(WAITING_VALUE); return SimpleTypes.SEPARATOR; } - case 14: break; - case 7: + case 12: break; + case 6: { yybegin(YYINITIAL); return SimpleTypes.VALUE; } - case 15: break; - case 8: + case 13: break; + case 7: { yybegin(WAITING_VALUE); return TokenType.WHITE_SPACE; } - case 16: break; + case 14: break; default: zzScanError(ZZ_NO_MATCH); } diff --git a/simple_language_plugin/testData/ParsingTestData.txt b/simple_language_plugin/testData/ParsingTestData.txt index 01012c591..012fa0291 100644 --- a/simple_language_plugin/testData/ParsingTestData.txt +++ b/simple_language_plugin/testData/ParsingTestData.txt @@ -1,63 +1,66 @@ Simple File(0,492) PsiComment(SimpleTokenType.COMMENT)('# You are reading the ".properties" entry.')(0,42) - PsiElement(SimpleTokenType.CRLF)('\n')(42,43) + PsiWhiteSpace('\n')(42,43) PsiComment(SimpleTokenType.COMMENT)('! The exclamation mark can also mark text as comments.')(43,97) - PsiElement(SimpleTokenType.CRLF)('\n')(97,98) + PsiWhiteSpace('\n')(97,98) SimplePropertyImpl(PROPERTY)(98,132) PsiElement(SimpleTokenType.KEY)('website')(98,105) PsiWhiteSpace(' ')(105,106) PsiElement(SimpleTokenType.SEPARATOR)('=')(106,107) PsiWhiteSpace(' ')(107,108) PsiElement(SimpleTokenType.VALUE)('http://en.wikipedia.org/')(108,132) - PsiElement(SimpleTokenType.CRLF)('\n\n')(132,134) + PsiWhiteSpace('\n\n')(132,134) SimplePropertyImpl(PROPERTY)(134,152) PsiElement(SimpleTokenType.KEY)('language')(134,142) PsiWhiteSpace(' ')(142,143) PsiElement(SimpleTokenType.SEPARATOR)('=')(143,144) PsiWhiteSpace(' ')(144,145) PsiElement(SimpleTokenType.VALUE)('English')(145,152) - PsiElement(SimpleTokenType.CRLF)('\n')(152,153) + PsiWhiteSpace('\n')(152,153) PsiComment(SimpleTokenType.COMMENT)('# The backslash below tells the application to continue reading')(153,216) - PsiElement(SimpleTokenType.CRLF)('\n')(216,217) + PsiWhiteSpace('\n')(216,217) PsiComment(SimpleTokenType.COMMENT)('# the value onto the next line.')(217,248) - PsiElement(SimpleTokenType.CRLF)('\n')(248,249) + PsiWhiteSpace('\n')(248,249) SimplePropertyImpl(PROPERTY)(249,292) PsiElement(SimpleTokenType.KEY)('message')(249,256) PsiWhiteSpace(' ')(256,257) PsiElement(SimpleTokenType.SEPARATOR)('=')(257,258) PsiWhiteSpace(' ')(258,259) PsiElement(SimpleTokenType.VALUE)('Welcome to \\n Wikipedia!')(259,292) - PsiElement(SimpleTokenType.CRLF)('\n')(292,293) + PsiWhiteSpace('\n')(292,293) PsiComment(SimpleTokenType.COMMENT)('# Add spaces to the key')(293,316) - PsiElement(SimpleTokenType.CRLF)('\n')(316,317) + PsiWhiteSpace('\n')(316,317) SimplePropertyImpl(PROPERTY)(317,410) PsiElement(SimpleTokenType.KEY)('key\ with\ spaces')(317,334) PsiWhiteSpace(' ')(334,335) PsiElement(SimpleTokenType.SEPARATOR)('=')(335,336) PsiWhiteSpace(' ')(336,337) PsiElement(SimpleTokenType.VALUE)('This is the value that could be looked up with the key "key with spaces".')(337,410) - PsiElement(SimpleTokenType.CRLF)('\n')(410,411) + PsiWhiteSpace('\n')(410,411) PsiComment(SimpleTokenType.COMMENT)('# Unicode')(411,420) - PsiElement(SimpleTokenType.CRLF)('\n')(420,421) + PsiWhiteSpace('\n')(420,421) SimplePropertyImpl(PROPERTY)(421,433) PsiElement(SimpleTokenType.KEY)('tab')(421,424) PsiWhiteSpace(' ')(424,425) PsiElement(SimpleTokenType.SEPARATOR)(':')(425,426) PsiWhiteSpace(' ')(426,427) PsiElement(SimpleTokenType.VALUE)('\u0009')(427,433) - PsiElement(SimpleTokenType.CRLF)('\n')(433,434) + PsiWhiteSpace('\n')(433,434) PsiComment(SimpleTokenType.COMMENT)('# test for illegal key attempt')(434,464) - PsiElement(SimpleTokenType.CRLF)('\n')(464,465) - SimplePropertyImpl(PROPERTY)(465,468) + PsiWhiteSpace('\n')(464,465) + SimplePropertyImpl(PROPERTY)(465,469) PsiElement(SimpleTokenType.KEY)('key')(465,468) - PsiErrorElement:, SimpleTokenType.COMMENT, SimpleTokenType.CRLF or SimpleTokenType.SEPARATOR expected, got '\'(468,469) - PsiElement(BAD_CHARACTER)('\')(468,469) - PsiElement(SimpleTokenType.CRLF)('\n')(469,470) - PsiElement(SimpleTokenType.KEY)('with')(470,474) - PsiElement(BAD_CHARACTER)('\')(474,475) - PsiElement(SimpleTokenType.CRLF)('\n')(475,476) - PsiElement(SimpleTokenType.KEY)('endofline')(476,485) - PsiWhiteSpace(' ')(485,486) - PsiElement(SimpleTokenType.SEPARATOR)('=')(486,487) - PsiWhiteSpace(' ')(487,488) - PsiElement(SimpleTokenType.VALUE)('test')(488,492) \ No newline at end of file + PsiErrorElement:SimpleTokenType.SEPARATOR expected, got '\'(468,469) + PsiElement(BAD_CHARACTER)('\')(468,469) + PsiWhiteSpace('\n')(469,470) + SimplePropertyImpl(PROPERTY)(470,475) + PsiElement(SimpleTokenType.KEY)('with')(470,474) + PsiErrorElement:SimpleTokenType.SEPARATOR expected, got '\'(474,475) + PsiElement(BAD_CHARACTER)('\')(474,475) + PsiWhiteSpace('\n')(475,476) + SimplePropertyImpl(PROPERTY)(476,492) + PsiElement(SimpleTokenType.KEY)('endofline')(476,485) + PsiWhiteSpace(' ')(485,486) + PsiElement(SimpleTokenType.SEPARATOR)('=')(486,487) + PsiWhiteSpace(' ')(487,488) + PsiElement(SimpleTokenType.VALUE)('test')(488,492) \ No newline at end of file