mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
IJSDK-203 Confusing grammar and no info on comments and whitespaces
This commit is contained in:
parent
e3943a8d71
commit
6bcf8623e5
@ -1,12 +1,15 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.parser;
|
package com.simpleplugin.parser;
|
||||||
|
|
||||||
import com.intellij.lang.*;
|
import com.intellij.lang.PsiBuilder;
|
||||||
import com.intellij.lang.PsiBuilder.Marker;
|
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.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"})
|
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
|
||||||
public class SimpleParser implements PsiParser, LightPsiParser {
|
public class SimpleParser implements PsiParser, LightPsiParser {
|
||||||
@ -22,7 +25,8 @@ public class SimpleParser implements PsiParser, LightPsiParser {
|
|||||||
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
|
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
|
||||||
if (t == PROPERTY) {
|
if (t == PROPERTY) {
|
||||||
r = property(b, 0);
|
r = property(b, 0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
r = parse_root_(t, b, 0);
|
r = parse_root_(t, b, 0);
|
||||||
}
|
}
|
||||||
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
|
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
|
||||||
@ -33,50 +37,28 @@ public class SimpleParser implements PsiParser, LightPsiParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************** */
|
/* ********************************************************** */
|
||||||
// property|COMMENT|CRLF
|
// (KEY SEPARATOR VALUE?)|KEY
|
||||||
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
|
|
||||||
public static boolean property(PsiBuilder b, int l) {
|
public static boolean property(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "property")) return false;
|
if (!recursion_guard_(b, l, "property")) return false;
|
||||||
if (!nextTokenIs(b, "<property>", KEY, SEPARATOR)) return false;
|
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b, l, _NONE_, "<property>");
|
Marker m = enter_section_(b, l, _NONE_, PROPERTY, "<property>");
|
||||||
r = property_0(b, l + 1);
|
r = property_0(b, l + 1);
|
||||||
if (!r) r = consumeToken(b, KEY);
|
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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// KEY? SEPARATOR VALUE?
|
// KEY SEPARATOR VALUE?
|
||||||
private static boolean property_0(PsiBuilder b, int l) {
|
private static boolean property_0(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "property_0")) return false;
|
if (!recursion_guard_(b, l, "property_0")) return false;
|
||||||
boolean r;
|
boolean r;
|
||||||
Marker m = enter_section_(b);
|
Marker m = enter_section_(b);
|
||||||
r = property_0_0(b, l + 1);
|
r = consumeTokens(b, 0, KEY, SEPARATOR);
|
||||||
r = r && consumeToken(b, SEPARATOR);
|
|
||||||
r = r && property_0_2(b, l + 1);
|
r = r && property_0_2(b, l + 1);
|
||||||
exit_section_(b, m, null, r);
|
exit_section_(b, m, null, r);
|
||||||
return 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?
|
// VALUE?
|
||||||
private static boolean property_0_2(PsiBuilder b, int l) {
|
private static boolean property_0_2(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "property_0_2")) return false;
|
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) {
|
static boolean simpleFile(PsiBuilder b, int l) {
|
||||||
if (!recursion_guard_(b, l, "simpleFile")) return false;
|
if (!recursion_guard_(b, l, "simpleFile")) return false;
|
||||||
int c = current_position_(b);
|
int c = current_position_(b);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!item_(b, l + 1)) break;
|
if (!simpleFile_0(b, l + 1)) break;
|
||||||
if (!empty_element_parsed_guard_(b, "simpleFile", c)) break;
|
if (!empty_element_parsed_guard_(b, "simpleFile", c)) break;
|
||||||
c = current_position_(b);
|
c = current_position_(b);
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
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.psi.PsiElement;
|
||||||
|
import com.intellij.navigation.ItemPresentation;
|
||||||
|
|
||||||
public interface SimpleProperty extends SimpleNamedElement {
|
public interface SimpleProperty extends SimpleNamedElement {
|
||||||
|
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
package com.simpleplugin.psi;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.psi.tree.IElementType;
|
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 {
|
public interface SimpleTypes {
|
||||||
|
|
||||||
IElementType PROPERTY = new SimpleElementType("PROPERTY");
|
IElementType PROPERTY = new SimpleElementType("PROPERTY");
|
||||||
|
|
||||||
IElementType COMMENT = new SimpleTokenType("COMMENT");
|
IElementType COMMENT = new SimpleTokenType("COMMENT");
|
||||||
IElementType CRLF = new SimpleTokenType("CRLF");
|
|
||||||
IElementType KEY = new SimpleTokenType("KEY");
|
IElementType KEY = new SimpleTokenType("KEY");
|
||||||
IElementType SEPARATOR = new SimpleTokenType("SEPARATOR");
|
IElementType SEPARATOR = new SimpleTokenType("SEPARATOR");
|
||||||
IElementType VALUE = new SimpleTokenType("VALUE");
|
IElementType VALUE = new SimpleTokenType("VALUE");
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
package com.simpleplugin.psi;
|
||||||
|
|
||||||
import com.intellij.psi.*;
|
import org.jetbrains.annotations.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
|
||||||
public class SimpleVisitor extends PsiElementVisitor {
|
public class SimpleVisitor extends PsiElementVisitor {
|
||||||
|
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi.impl;
|
package com.simpleplugin.psi.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.jetbrains.annotations.*;
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import com.intellij.navigation.ItemPresentation;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
|
import static com.simpleplugin.psi.SimpleTypes.*;
|
||||||
import com.simpleplugin.psi.*;
|
import com.simpleplugin.psi.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import com.intellij.navigation.ItemPresentation;
|
||||||
|
|
||||||
public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty {
|
public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty {
|
||||||
|
|
||||||
@ -13,8 +17,12 @@ public class SimplePropertyImpl extends SimpleNamedElementImpl implements Simple
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void accept(@NotNull SimpleVisitor visitor) {
|
||||||
|
visitor.visitProperty(this);
|
||||||
|
}
|
||||||
|
|
||||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
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);
|
else super.accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,16 +5,22 @@ import com.intellij.lang.ASTNode;
|
|||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.command.WriteCommandAction;
|
import com.intellij.openapi.command.WriteCommandAction;
|
||||||
import com.intellij.openapi.editor.Editor;
|
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.fileEditor.FileEditorManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
import com.intellij.pom.Navigatable;
|
import com.intellij.pom.Navigatable;
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.search.*;
|
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.IncorrectOperationException;
|
||||||
import com.intellij.util.indexing.FileBasedIndex;
|
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 org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -73,7 +79,8 @@ class CreatePropertyQuickFix extends BaseIntentionAction {
|
|||||||
public void run() {
|
public void run() {
|
||||||
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(file);
|
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(file);
|
||||||
ASTNode lastChildNode = simpleFile.getNode().getLastChildNode();
|
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());
|
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
|
// IMPORTANT: change spaces to escaped spaces or the new node will only have the first word for the key
|
||||||
|
@ -15,9 +15,14 @@
|
|||||||
psiImplUtilClass="com.simpleplugin.psi.impl.SimplePsiImplUtil"
|
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"
|
private recover_property ::= !(KEY|SEPARATOR|COMMENT)
|
||||||
implements="com.simpleplugin.psi.SimpleNamedElement" methods=[getKey getValue getName setName getNameIdentifier getPresentation]}
|
|
@ -15,11 +15,11 @@ import com.intellij.psi.TokenType;
|
|||||||
%eof{ return;
|
%eof{ return;
|
||||||
%eof}
|
%eof}
|
||||||
|
|
||||||
CRLF=\n
|
CRLF=\R
|
||||||
WHITE_SPACE=[\ \t\f]
|
WHITE_SPACE=[\ \n\t\f]
|
||||||
FIRST_VALUE_CHARACTER=[^ \n\f\\] | "\\"{CRLF} | "\\".
|
FIRST_VALUE_CHARACTER=[^ \n\f\\] | "\\"{CRLF} | "\\".
|
||||||
VALUE_CHARACTER=[^\n\f\\] | "\\"{CRLF} | "\\".
|
VALUE_CHARACTER=[^\n\f\\] | "\\"{CRLF} | "\\".
|
||||||
END_OF_LINE_COMMENT=("#"|"!")[^\n]*
|
END_OF_LINE_COMMENT=("#"|"!")[^\r\n]*
|
||||||
SEPARATOR=[:=]
|
SEPARATOR=[:=]
|
||||||
KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ "
|
KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ "
|
||||||
|
|
||||||
@ -39,8 +39,6 @@ KEY_CHARACTER=[^:=\ \n\t\f\\] | "\\ "
|
|||||||
|
|
||||||
<WAITING_VALUE> {FIRST_VALUE_CHARACTER}{VALUE_CHARACTER}* { yybegin(YYINITIAL); return SimpleTypes.VALUE; }
|
<WAITING_VALUE> {FIRST_VALUE_CHARACTER}{VALUE_CHARACTER}* { yybegin(YYINITIAL); return SimpleTypes.VALUE; }
|
||||||
|
|
||||||
{CRLF}+ { yybegin(YYINITIAL); return SimpleTypes.CRLF; }
|
({CRLF}|{WHITE_SPACE})+ { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
|
||||||
|
|
||||||
{WHITE_SPACE}+ { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
|
|
||||||
|
|
||||||
. { return TokenType.BAD_CHARACTER; }
|
. { return TokenType.BAD_CHARACTER; }
|
||||||
|
@ -4,7 +4,6 @@ import com.intellij.formatting.*;
|
|||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import com.intellij.psi.TokenType;
|
import com.intellij.psi.TokenType;
|
||||||
import com.intellij.psi.formatter.common.AbstractBlock;
|
import com.intellij.psi.formatter.common.AbstractBlock;
|
||||||
import com.simpleplugin.psi.SimpleTypes;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ public class SimpleBlock extends AbstractBlock {
|
|||||||
List<Block> blocks = new ArrayList<Block>();
|
List<Block> blocks = new ArrayList<Block>();
|
||||||
ASTNode child = myNode.getFirstChildNode();
|
ASTNode child = myNode.getFirstChildNode();
|
||||||
while (child != null) {
|
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(),
|
Block block = new SimpleBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(),
|
||||||
spacingBuilder);
|
spacingBuilder);
|
||||||
blocks.add(block);
|
blocks.add(block);
|
||||||
|
@ -54,8 +54,8 @@ class SimpleLexer implements FlexLexer {
|
|||||||
|
|
||||||
/* The ZZ_CMAP_A table has 320 entries */
|
/* The ZZ_CMAP_A table has 320 entries */
|
||||||
static final char ZZ_CMAP_A[] = zzUnpackCMap(
|
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"+
|
"\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"+
|
||||||
"\50\0\1\5\242\0\2\5\26\0");
|
"\6\50\0\1\1\242\0\2\1\26\0");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates DFA states to action switch labels.
|
* 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 int [] ZZ_ACTION = zzUnpackAction();
|
||||||
|
|
||||||
private static final String ZZ_ACTION_PACKED_0 =
|
private static final String ZZ_ACTION_PACKED_0 =
|
||||||
"\2\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+
|
"\2\0\2\1\1\2\1\3\1\4\1\5\2\6\2\7"+
|
||||||
"\1\2\1\10\1\4\1\10\2\0\1\3";
|
"\1\3\1\7\1\0\2\4\1\0\1\2\2\6";
|
||||||
|
|
||||||
private static int [] zzUnpackAction() {
|
private static int [] zzUnpackAction() {
|
||||||
int [] result = new int[16];
|
int [] result = new int[21];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
||||||
return result;
|
return result;
|
||||||
@ -92,11 +92,12 @@ class SimpleLexer implements FlexLexer {
|
|||||||
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
||||||
|
|
||||||
private static final String ZZ_ROWMAP_PACKED_0 =
|
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\0\0\12\0\24\0\36\0\50\0\62\0\74\0\106"+
|
||||||
"\0\110\0\121\0\132\0\143\0\154\0\55\0\143\0\121";
|
"\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() {
|
private static int [] zzUnpackRowMap() {
|
||||||
int [] result = new int[16];
|
int [] result = new int[21];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
||||||
return result;
|
return result;
|
||||||
@ -119,18 +120,22 @@ class SimpleLexer implements FlexLexer {
|
|||||||
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
private static final int [] ZZ_TRANS = zzUnpackTrans();
|
||||||
|
|
||||||
private static final String ZZ_TRANS_PACKED_0 =
|
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\3\1\4\1\5\1\4\2\5\1\6\1\5\1\7"+
|
||||||
"\1\10\1\11\1\12\1\13\1\14\1\15\1\11\1\15"+
|
"\1\10\1\11\1\12\1\13\1\12\1\14\1\13\1\15"+
|
||||||
"\2\11\1\3\2\0\1\16\1\0\1\3\1\0\1\3"+
|
"\1\16\2\11\2\3\1\0\1\3\2\0\1\17\1\0"+
|
||||||
"\2\0\1\4\11\0\1\5\1\0\1\5\1\0\1\5"+
|
"\1\3\1\0\1\3\1\4\1\5\1\4\2\5\1\17"+
|
||||||
"\6\0\1\3\4\0\1\7\1\0\7\7\11\0\1\11"+
|
"\1\5\1\3\2\0\5\5\1\0\1\5\11\0\1\3"+
|
||||||
"\1\0\1\11\1\17\2\11\1\0\2\11\1\0\2\20"+
|
"\2\0\2\7\1\0\1\3\2\20\1\21\1\20\1\7"+
|
||||||
"\1\0\1\20\1\0\1\20\2\0\1\11\1\0\1\13"+
|
"\1\20\12\0\2\11\1\0\2\11\1\0\1\22\4\11"+
|
||||||
"\1\17\1\13\1\11\1\15\7\11\2\0\2\11\2\0"+
|
"\1\23\1\5\2\23\1\5\1\22\1\23\3\11\1\24"+
|
||||||
"\1\15\1\0\1\15\1\0\1\15\2\0";
|
"\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() {
|
private static int [] zzUnpackTrans() {
|
||||||
int [] result = new int[117];
|
int [] result = new int[170];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
||||||
return result;
|
return result;
|
||||||
@ -168,10 +173,10 @@ class SimpleLexer implements FlexLexer {
|
|||||||
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
||||||
|
|
||||||
private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
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() {
|
private static int [] zzUnpackAttribute() {
|
||||||
int [] result = new int[16];
|
int [] result = new int[21];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
||||||
return result;
|
return result;
|
||||||
@ -487,35 +492,31 @@ class SimpleLexer implements FlexLexer {
|
|||||||
case 1:
|
case 1:
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.KEY;
|
{ yybegin(YYINITIAL); return SimpleTypes.KEY;
|
||||||
}
|
}
|
||||||
case 9: break;
|
case 8: break;
|
||||||
case 2:
|
case 2:
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.CRLF;
|
|
||||||
}
|
|
||||||
case 10: break;
|
|
||||||
case 3:
|
|
||||||
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
|
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
case 11: break;
|
case 9: break;
|
||||||
case 4:
|
case 3:
|
||||||
{ return TokenType.BAD_CHARACTER;
|
{ return TokenType.BAD_CHARACTER;
|
||||||
}
|
}
|
||||||
case 12: break;
|
case 10: break;
|
||||||
case 5:
|
case 4:
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.COMMENT;
|
{ yybegin(YYINITIAL); return SimpleTypes.COMMENT;
|
||||||
}
|
}
|
||||||
case 13: break;
|
case 11: break;
|
||||||
case 6:
|
case 5:
|
||||||
{ yybegin(WAITING_VALUE); return SimpleTypes.SEPARATOR;
|
{ yybegin(WAITING_VALUE); return SimpleTypes.SEPARATOR;
|
||||||
}
|
}
|
||||||
case 14: break;
|
case 12: break;
|
||||||
case 7:
|
case 6:
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.VALUE;
|
{ yybegin(YYINITIAL); return SimpleTypes.VALUE;
|
||||||
}
|
}
|
||||||
case 15: break;
|
case 13: break;
|
||||||
case 8:
|
case 7:
|
||||||
{ yybegin(WAITING_VALUE); return TokenType.WHITE_SPACE;
|
{ yybegin(WAITING_VALUE); return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
case 16: break;
|
case 14: break;
|
||||||
default:
|
default:
|
||||||
zzScanError(ZZ_NO_MATCH);
|
zzScanError(ZZ_NO_MATCH);
|
||||||
}
|
}
|
||||||
|
@ -1,61 +1,64 @@
|
|||||||
Simple File(0,492)
|
Simple File(0,492)
|
||||||
PsiComment(SimpleTokenType.COMMENT)('# You are reading the ".properties" entry.')(0,42)
|
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)
|
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)
|
SimplePropertyImpl(PROPERTY)(98,132)
|
||||||
PsiElement(SimpleTokenType.KEY)('website')(98,105)
|
PsiElement(SimpleTokenType.KEY)('website')(98,105)
|
||||||
PsiWhiteSpace(' ')(105,106)
|
PsiWhiteSpace(' ')(105,106)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)('=')(106,107)
|
PsiElement(SimpleTokenType.SEPARATOR)('=')(106,107)
|
||||||
PsiWhiteSpace(' ')(107,108)
|
PsiWhiteSpace(' ')(107,108)
|
||||||
PsiElement(SimpleTokenType.VALUE)('http://en.wikipedia.org/')(108,132)
|
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)
|
SimplePropertyImpl(PROPERTY)(134,152)
|
||||||
PsiElement(SimpleTokenType.KEY)('language')(134,142)
|
PsiElement(SimpleTokenType.KEY)('language')(134,142)
|
||||||
PsiWhiteSpace(' ')(142,143)
|
PsiWhiteSpace(' ')(142,143)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)('=')(143,144)
|
PsiElement(SimpleTokenType.SEPARATOR)('=')(143,144)
|
||||||
PsiWhiteSpace(' ')(144,145)
|
PsiWhiteSpace(' ')(144,145)
|
||||||
PsiElement(SimpleTokenType.VALUE)('English')(145,152)
|
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)
|
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)
|
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)
|
SimplePropertyImpl(PROPERTY)(249,292)
|
||||||
PsiElement(SimpleTokenType.KEY)('message')(249,256)
|
PsiElement(SimpleTokenType.KEY)('message')(249,256)
|
||||||
PsiWhiteSpace(' ')(256,257)
|
PsiWhiteSpace(' ')(256,257)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)('=')(257,258)
|
PsiElement(SimpleTokenType.SEPARATOR)('=')(257,258)
|
||||||
PsiWhiteSpace(' ')(258,259)
|
PsiWhiteSpace(' ')(258,259)
|
||||||
PsiElement(SimpleTokenType.VALUE)('Welcome to \\n Wikipedia!')(259,292)
|
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)
|
PsiComment(SimpleTokenType.COMMENT)('# Add spaces to the key')(293,316)
|
||||||
PsiElement(SimpleTokenType.CRLF)('\n')(316,317)
|
PsiWhiteSpace('\n')(316,317)
|
||||||
SimplePropertyImpl(PROPERTY)(317,410)
|
SimplePropertyImpl(PROPERTY)(317,410)
|
||||||
PsiElement(SimpleTokenType.KEY)('key\ with\ spaces')(317,334)
|
PsiElement(SimpleTokenType.KEY)('key\ with\ spaces')(317,334)
|
||||||
PsiWhiteSpace(' ')(334,335)
|
PsiWhiteSpace(' ')(334,335)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)('=')(335,336)
|
PsiElement(SimpleTokenType.SEPARATOR)('=')(335,336)
|
||||||
PsiWhiteSpace(' ')(336,337)
|
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.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)
|
PsiComment(SimpleTokenType.COMMENT)('# Unicode')(411,420)
|
||||||
PsiElement(SimpleTokenType.CRLF)('\n')(420,421)
|
PsiWhiteSpace('\n')(420,421)
|
||||||
SimplePropertyImpl(PROPERTY)(421,433)
|
SimplePropertyImpl(PROPERTY)(421,433)
|
||||||
PsiElement(SimpleTokenType.KEY)('tab')(421,424)
|
PsiElement(SimpleTokenType.KEY)('tab')(421,424)
|
||||||
PsiWhiteSpace(' ')(424,425)
|
PsiWhiteSpace(' ')(424,425)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)(':')(425,426)
|
PsiElement(SimpleTokenType.SEPARATOR)(':')(425,426)
|
||||||
PsiWhiteSpace(' ')(426,427)
|
PsiWhiteSpace(' ')(426,427)
|
||||||
PsiElement(SimpleTokenType.VALUE)('\u0009')(427,433)
|
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)
|
PsiComment(SimpleTokenType.COMMENT)('# test for illegal key attempt')(434,464)
|
||||||
PsiElement(SimpleTokenType.CRLF)('\n')(464,465)
|
PsiWhiteSpace('\n')(464,465)
|
||||||
SimplePropertyImpl(PROPERTY)(465,468)
|
SimplePropertyImpl(PROPERTY)(465,469)
|
||||||
PsiElement(SimpleTokenType.KEY)('key')(465,468)
|
PsiElement(SimpleTokenType.KEY)('key')(465,468)
|
||||||
PsiErrorElement:<property>, SimpleTokenType.COMMENT, SimpleTokenType.CRLF or SimpleTokenType.SEPARATOR expected, got '\'(468,469)
|
PsiErrorElement:SimpleTokenType.SEPARATOR expected, got '\'(468,469)
|
||||||
PsiElement(BAD_CHARACTER)('\')(468,469)
|
PsiElement(BAD_CHARACTER)('\')(468,469)
|
||||||
PsiElement(SimpleTokenType.CRLF)('\n')(469,470)
|
PsiWhiteSpace('\n')(469,470)
|
||||||
|
SimplePropertyImpl(PROPERTY)(470,475)
|
||||||
PsiElement(SimpleTokenType.KEY)('with')(470,474)
|
PsiElement(SimpleTokenType.KEY)('with')(470,474)
|
||||||
|
PsiErrorElement:SimpleTokenType.SEPARATOR expected, got '\'(474,475)
|
||||||
PsiElement(BAD_CHARACTER)('\')(474,475)
|
PsiElement(BAD_CHARACTER)('\')(474,475)
|
||||||
PsiElement(SimpleTokenType.CRLF)('\n')(475,476)
|
PsiWhiteSpace('\n')(475,476)
|
||||||
|
SimplePropertyImpl(PROPERTY)(476,492)
|
||||||
PsiElement(SimpleTokenType.KEY)('endofline')(476,485)
|
PsiElement(SimpleTokenType.KEY)('endofline')(476,485)
|
||||||
PsiWhiteSpace(' ')(485,486)
|
PsiWhiteSpace(' ')(485,486)
|
||||||
PsiElement(SimpleTokenType.SEPARATOR)('=')(486,487)
|
PsiElement(SimpleTokenType.SEPARATOR)('=')(486,487)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user