14 |
15 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/RONValue.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.psi.PsiElement;
7 |
8 | public interface RONValue extends PsiElement {
9 |
10 | @Nullable
11 | RONBool getBool();
12 |
13 | @Nullable
14 | RONList getList();
15 |
16 | @Nullable
17 | RONMap getMap();
18 |
19 | @Nullable
20 | RONNamedField getNamedField();
21 |
22 | @Nullable
23 | RONObject getObject();
24 |
25 | @Nullable
26 | RONOption getOption();
27 |
28 | @Nullable
29 | PsiElement getChar();
30 |
31 | @Nullable
32 | PsiElement getFloat();
33 |
34 | @Nullable
35 | PsiElement getInteger();
36 |
37 | @Nullable
38 | PsiElement getString();
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/psi/RONFile.java:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language.psi;
2 |
3 | import com.intellij.extapi.psi.PsiFileBase;
4 | import com.intellij.lang.Language;
5 | import com.intellij.openapi.fileTypes.FileType;
6 | import com.intellij.psi.FileViewProvider;
7 | import org.jetbrains.annotations.NotNull;
8 | import org.jonahhenriksson.ron.language.RONFileType;
9 | import org.jonahhenriksson.ron.language.RONLanguage;
10 |
11 | public class RONFile extends PsiFileBase {
12 | public RONFile(@NotNull FileViewProvider viewProvider) {
13 | super(viewProvider, RONLanguage.INSTANCE);
14 | }
15 |
16 | @Override
17 | public @NotNull FileType getFileType() {
18 | return RONFileType.INSTANCE;
19 | }
20 |
21 | @Override
22 | public String toString() {
23 | return "RON File";
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/RONFileType.java:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language;
2 |
3 | import com.intellij.openapi.fileTypes.LanguageFileType;
4 | import com.intellij.openapi.util.NlsContexts;
5 | import org.jetbrains.annotations.NotNull;
6 | import org.jetbrains.annotations.Nullable;
7 |
8 | import javax.swing.*;
9 |
10 | public class RONFileType extends LanguageFileType {
11 | public static final RONFileType INSTANCE = new RONFileType();
12 |
13 | private RONFileType() {
14 | super(RONLanguage.INSTANCE);
15 | }
16 |
17 | @Override
18 | public @NotNull String getName() {
19 | return "RON file";
20 | }
21 |
22 | @Override
23 | public @NotNull @NlsContexts.Label String getDescription() {
24 | return "Rusty Object Notation file";
25 | }
26 |
27 | @Override
28 | public @NotNull String getDefaultExtension() {
29 | return "ron";
30 | }
31 |
32 | @Override
33 | public @Nullable Icon getIcon() {
34 | return RONIcons.FILE;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [year] [fullname]
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/.idea/$CACHE_FILE$:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Code styleScala
10 |
11 |
12 | Java
13 |
14 |
15 | Java interop issuesKotlin
16 |
17 |
18 | Kotlin
19 |
20 |
21 | Packaging issuesJava
22 |
23 |
24 | Probable bugsJava
25 |
26 |
27 | Scala
28 |
29 |
30 | Version control
31 |
32 |
33 |
34 |
35 | Ant
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONBoolImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONBoolImpl extends ASTWrapperPsiElement implements RONBool {
15 |
16 | public RONBoolImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitBool(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public PsiElement getBoolean() {
32 | return findNotNullChildByType(BOOLEAN);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONOptionImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONOptionImpl extends ASTWrapperPsiElement implements RONOption {
15 |
16 | public RONOptionImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitOption(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public RONValue getValue() {
32 | return findNotNullChildByClass(RONValue.class);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/RONCreateFile.java:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language;
2 |
3 | import com.intellij.ide.actions.CreateFileFromTemplateAction;
4 | import com.intellij.ide.actions.CreateFileFromTemplateDialog;
5 | import com.intellij.openapi.project.Project;
6 | import com.intellij.openapi.util.NlsActions;
7 | import com.intellij.openapi.util.NlsContexts;
8 | import com.intellij.psi.PsiDirectory;
9 | import org.jetbrains.annotations.NotNull;
10 |
11 | import javax.swing.*;
12 |
13 | public class RONCreateFile extends CreateFileFromTemplateAction {
14 |
15 | private static final String NAME = "RON File";
16 |
17 | public RONCreateFile() {
18 | super(NAME, "Create new RON file", RONIcons.FILE);
19 | }
20 |
21 | @Override
22 | protected void buildDialog(@NotNull Project project, @NotNull PsiDirectory directory, CreateFileFromTemplateDialog.@NotNull Builder builder) {
23 | builder.setTitle(NAME).addKind("Empty file", RONIcons.FILE, "RON File");
24 | }
25 |
26 | @Override
27 | protected @NlsContexts.Command String getActionName(PsiDirectory directory, @NotNull String newName, String templateName) {
28 | return NAME;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONListImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONListImpl extends ASTWrapperPsiElement implements RONList {
15 |
16 | public RONListImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitList(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public List getValueList() {
32 | return PsiTreeUtil.getChildrenOfTypeAsList(this, RONValue.class);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONMapImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONMapImpl extends ASTWrapperPsiElement implements RONMap {
15 |
16 | public RONMapImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitMap(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public List getMapEntryList() {
32 | return PsiTreeUtil.getChildrenOfTypeAsList(this, RONMapEntry.class);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/RONVisitor.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi;
3 |
4 | import org.jetbrains.annotations.*;
5 | import com.intellij.psi.PsiElementVisitor;
6 | import com.intellij.psi.PsiElement;
7 |
8 | public class RONVisitor extends PsiElementVisitor {
9 |
10 | public void visitBool(@NotNull RONBool o) {
11 | visitPsiElement(o);
12 | }
13 |
14 | public void visitList(@NotNull RONList o) {
15 | visitPsiElement(o);
16 | }
17 |
18 | public void visitMap(@NotNull RONMap o) {
19 | visitPsiElement(o);
20 | }
21 |
22 | public void visitMapEntry(@NotNull RONMapEntry o) {
23 | visitPsiElement(o);
24 | }
25 |
26 | public void visitNamedField(@NotNull RONNamedField o) {
27 | visitPsiElement(o);
28 | }
29 |
30 | public void visitObject(@NotNull RONObject o) {
31 | visitPsiElement(o);
32 | }
33 |
34 | public void visitOption(@NotNull RONOption o) {
35 | visitPsiElement(o);
36 | }
37 |
38 | public void visitValue(@NotNull RONValue o) {
39 | visitPsiElement(o);
40 | }
41 |
42 | public void visitPsiElement(@NotNull PsiElement o) {
43 | visitElement(o);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 | org.jonahhenriksson.ron
3 | RON
4 | Jonah Henriksson
5 |
6 |
9 |
10 | com.intellij.modules.platform
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONMapEntryImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONMapEntryImpl extends ASTWrapperPsiElement implements RONMapEntry {
15 |
16 | public RONMapEntryImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitMapEntry(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public List getValueList() {
32 | return PsiTreeUtil.getChildrenOfTypeAsList(this, RONValue.class);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONNamedFieldImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONNamedFieldImpl extends ASTWrapperPsiElement implements RONNamedField {
15 |
16 | public RONNamedFieldImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitNamedField(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public RONValue getValue() {
32 | return findNotNullChildByClass(RONValue.class);
33 | }
34 |
35 | @Override
36 | @NotNull
37 | public PsiElement getIdent() {
38 | return findNotNullChildByType(IDENT);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONObjectImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONObjectImpl extends ASTWrapperPsiElement implements RONObject {
15 |
16 | public RONObjectImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitObject(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @NotNull
31 | public List getValueList() {
32 | return PsiTreeUtil.getChildrenOfTypeAsList(this, RONValue.class);
33 | }
34 |
35 | @Override
36 | @Nullable
37 | public PsiElement getIdent() {
38 | return findChildByType(IDENT);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # intellij-ron
2 | [](https://plugins.jetbrains.com/plugin/14897-ron/)
3 |
4 | A plugin that adds RON (Rusty Object Notation) support to IntelliJ IDEA
5 |
6 | ## Versions
7 | 1.4 - Updated to support 2020.3 edition of Intellij IDEs
8 |
9 | 1.3 - Adds support for block comments and cleaned up some code
10 |
11 | 1.2 - Adds context menu option for creating RON files
12 |
13 | 1.1 - Fixes issues with recognizing types, and allows raw strings to work properly
14 |
15 | 1.0 - Allows underscores in identifiers and extensions, and fixed maps and lists
16 |
17 | 1.0-SNAPSHOT - Initial release, very buggy, but adds basic support for highlighting RON files
18 |
19 | ## Contributing
20 | If there is a specific feature you want to see, or an issue with the plugin, make an issue, and I'll try to get back to it.
21 | If you want to add a feature or resolve an issue, first let me know by replying to a feature request or issue report, and then make a pull request.
22 |
23 |
24 | ## Building
25 | Requires Intellij IDEA, Gradle CLI and the plugins Grammar-Kit, PsiViewer, and Plugin DevKit.
26 |
27 | To build, run the command `gradle buildPlugin`, and the zipped plugin will be generated in build/distributions
28 |
29 | ## License
30 | intellij-ron is dual-licensed under Apache-2 and MIT.
--------------------------------------------------------------------------------
/src/main/resources/icons/ronFile.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
27 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/RONParserDefinition.java:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language;
2 |
3 | import com.intellij.lang.ASTNode;
4 | import com.intellij.lang.ParserDefinition;
5 | import com.intellij.lang.PsiParser;
6 | import com.intellij.lexer.Lexer;
7 | import com.intellij.openapi.project.Project;
8 | import com.intellij.psi.FileViewProvider;
9 | import com.intellij.psi.PsiElement;
10 | import com.intellij.psi.PsiFile;
11 | import com.intellij.psi.TokenType;
12 | import com.intellij.psi.tree.IFileElementType;
13 | import com.intellij.psi.tree.TokenSet;
14 | import org.jetbrains.annotations.NotNull;
15 | import org.jonahhenriksson.ron.language.parser._RONParser;
16 | import org.jonahhenriksson.ron.language.psi.RONElementType;
17 | import org.jonahhenriksson.ron.language.psi.RONFile;
18 | import org.jonahhenriksson.ron.language.psi.RONTypes;
19 |
20 | public class RONParserDefinition implements ParserDefinition {
21 | public static final TokenSet COMMENTS = TokenSet.create(RONTypes.COMMENT, RONTypes.BLOCK_COMMENT);
22 | public static final TokenSet STRING_LITERALS = TokenSet.create(RONTypes.STRING);
23 |
24 | public static final IFileElementType FILE = new IFileElementType(RONLanguage.INSTANCE);
25 |
26 | @Override
27 | public @NotNull Lexer createLexer(Project project) {
28 | return new RONLexerAdapter();
29 | }
30 |
31 | @Override
32 | public PsiParser createParser(Project project) {
33 | return new _RONParser();
34 | }
35 |
36 | @Override
37 | public IFileElementType getFileNodeType() {
38 | return FILE;
39 | }
40 |
41 | @Override
42 | public @NotNull TokenSet getCommentTokens() {
43 | return COMMENTS;
44 | }
45 |
46 | @Override
47 | public @NotNull TokenSet getStringLiteralElements() {
48 | return STRING_LITERALS;
49 | }
50 |
51 | @Override
52 | public @NotNull PsiElement createElement(ASTNode node) {
53 | return RONTypes.Factory.createElement(node);
54 | }
55 |
56 | @Override
57 | public PsiFile createFile(FileViewProvider viewProvider) {
58 | return new RONFile(viewProvider);
59 | }
60 |
61 | public SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right) {
62 | return SpaceRequirements.MAY;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/impl/RONValueImpl.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi.impl;
3 |
4 | import java.util.List;
5 | import org.jetbrains.annotations.*;
6 | import com.intellij.lang.ASTNode;
7 | import com.intellij.psi.PsiElement;
8 | import com.intellij.psi.PsiElementVisitor;
9 | import com.intellij.psi.util.PsiTreeUtil;
10 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
11 | import com.intellij.extapi.psi.ASTWrapperPsiElement;
12 | import org.jonahhenriksson.ron.language.psi.*;
13 |
14 | public class RONValueImpl extends ASTWrapperPsiElement implements RONValue {
15 |
16 | public RONValueImpl(@NotNull ASTNode node) {
17 | super(node);
18 | }
19 |
20 | public void accept(@NotNull RONVisitor visitor) {
21 | visitor.visitValue(this);
22 | }
23 |
24 | public void accept(@NotNull PsiElementVisitor visitor) {
25 | if (visitor instanceof RONVisitor) accept((RONVisitor)visitor);
26 | else super.accept(visitor);
27 | }
28 |
29 | @Override
30 | @Nullable
31 | public RONBool getBool() {
32 | return findChildByClass(RONBool.class);
33 | }
34 |
35 | @Override
36 | @Nullable
37 | public RONList getList() {
38 | return findChildByClass(RONList.class);
39 | }
40 |
41 | @Override
42 | @Nullable
43 | public RONMap getMap() {
44 | return findChildByClass(RONMap.class);
45 | }
46 |
47 | @Override
48 | @Nullable
49 | public RONNamedField getNamedField() {
50 | return findChildByClass(RONNamedField.class);
51 | }
52 |
53 | @Override
54 | @Nullable
55 | public RONObject getObject() {
56 | return findChildByClass(RONObject.class);
57 | }
58 |
59 | @Override
60 | @Nullable
61 | public RONOption getOption() {
62 | return findChildByClass(RONOption.class);
63 | }
64 |
65 | @Override
66 | @Nullable
67 | public PsiElement getChar() {
68 | return findChildByType(CHAR);
69 | }
70 |
71 | @Override
72 | @Nullable
73 | public PsiElement getFloat() {
74 | return findChildByType(FLOAT);
75 | }
76 |
77 | @Override
78 | @Nullable
79 | public PsiElement getInteger() {
80 | return findChildByType(INTEGER);
81 | }
82 |
83 | @Override
84 | @Nullable
85 | public PsiElement getString() {
86 | return findChildByType(STRING);
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/RON.bnf:
--------------------------------------------------------------------------------
1 | {
2 | parserClass = "org.jonahhenriksson.ron.language.parser._RONParser"
3 | parserUtilClass = "org.jonahhenriksson.ron.language.psi.RONParserUtil"
4 |
5 | extends = "com.intellij.extapi.psi.ASTWrapperPsiElement"
6 |
7 | psiClassPrefix = "RON"
8 | psiImplClassSuffix = "Impl"
9 | psiPackage = "org.jonahhenriksson.ron.language.psi"
10 | psiImplPackage = "org.jonahhenriksson.ron.language.psi.impl"
11 |
12 | elementTypeHolderClass = "org.jonahhenriksson.ron.language.psi.RONTypes"
13 | elementTypeClass = "org.jonahhenriksson.ron.language.psi.RONElementType"
14 | tokenTypeClass = "org.jonahhenriksson.ron.language.psi.RONTokenType"
15 |
16 | psiImplUtilClass = "org.jonahhenriksson.ron.language.psi.impl.RONPsiImplUtil"
17 |
18 | tokens = [
19 | COMMENT = "regexp://.*"
20 | BLOCK_COMMENT = "BLOCK COMMENT"
21 |
22 | BOOLEAN = "regexp:true|false"
23 |
24 | IDENT = "regexp:[A-Za-z_]+"
25 |
26 | INTEGER = "regexp:[+-]?((0x[0-9A-Fa-f][0-9A-Fa-f_]*)|((0[bo]?)?[0-9][0-9_]*))"
27 | FLOAT = "regexp:([+-]?[0-9]+\.[0-9]*([Ee][0-9]+)?)|(\.[0-9]+([Ee][0-9]+)?)"
28 |
29 | CHAR = "regexp:'([ -&(-\[\]-~])|(\\')|(\\\\)'"
30 | STRING = "regexp:\"([^\r\n\"]|(\\[\S]))*\""
31 | RAW_STRING = "RAW STRING"
32 |
33 | EXTENSION = "regexp:#!\[enable\([A-Za-z_]+\)\]"
34 | PARENTHESISL = "("
35 | PARENTHESISR = ")"
36 | BRACKETL = "["
37 | BRACKETR = "]"
38 | BRACEL = "{"
39 | BRACER = "}"
40 | COLON = ":"
41 | COMMA = ","
42 | SOME = "Some"
43 | ]
44 | }
45 |
46 | // RON File
47 | RON ::= [extension+] value;
48 |
49 | // Extension
50 | private extension ::= EXTENSION;
51 |
52 | // Values
53 | value ::= bool | integer | float | string | char | option | list | map | named_field | object;
54 |
55 | // Bool
56 | bool ::= BOOLEAN;
57 |
58 | // Integer
59 | private integer ::= INTEGER;
60 |
61 | // Float
62 | private float ::= FLOAT;
63 |
64 | // String
65 | private string ::= STRING | RAW_STRING;
66 |
67 | // Char
68 | private char ::= CHAR;
69 |
70 | // Option
71 | option ::= SOME PARENTHESISL value PARENTHESISR;
72 |
73 | // List
74 | list ::= BRACKETL [value (COMMA value)* [COMMA]] BRACKETR;
75 |
76 | // Map
77 | map ::= BRACEL [map_entry (COMMA map_entry)* [COMMA]] BRACER
78 | map_entry ::= value COLON value;
79 |
80 | // Named Field for Struct
81 | named_field ::= IDENT COLON value;
82 |
83 | // Tuple + Enum Tuple + Tuple Struct + Struct + Unit Struct + Named Enum
84 | object ::= [IDENT] PARENTHESISL [value (COMMA value)* [COMMA]] PARENTHESISR | PARENTHESISL PARENTHESISR | IDENT;
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/psi/RONTypes.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.psi;
3 |
4 | import com.intellij.psi.tree.IElementType;
5 | import com.intellij.psi.PsiElement;
6 | import com.intellij.lang.ASTNode;
7 | import org.jonahhenriksson.ron.language.psi.impl.*;
8 |
9 | public interface RONTypes {
10 |
11 | IElementType BOOL = new RONElementType("BOOL");
12 | IElementType LIST = new RONElementType("LIST");
13 | IElementType MAP = new RONElementType("MAP");
14 | IElementType MAP_ENTRY = new RONElementType("MAP_ENTRY");
15 | IElementType NAMED_FIELD = new RONElementType("NAMED_FIELD");
16 | IElementType OBJECT = new RONElementType("OBJECT");
17 | IElementType OPTION = new RONElementType("OPTION");
18 | IElementType VALUE = new RONElementType("VALUE");
19 |
20 | IElementType BLOCK_COMMENT = new RONTokenType("BLOCK COMMENT");
21 | IElementType BOOLEAN = new RONTokenType("BOOLEAN");
22 | IElementType BRACEL = new RONTokenType("{");
23 | IElementType BRACER = new RONTokenType("}");
24 | IElementType BRACKETL = new RONTokenType("[");
25 | IElementType BRACKETR = new RONTokenType("]");
26 | IElementType CHAR = new RONTokenType("CHAR");
27 | IElementType COLON = new RONTokenType(":");
28 | IElementType COMMA = new RONTokenType(",");
29 | IElementType COMMENT = new RONTokenType("COMMENT");
30 | IElementType EXTENSION = new RONTokenType("EXTENSION");
31 | IElementType FLOAT = new RONTokenType("FLOAT");
32 | IElementType IDENT = new RONTokenType("IDENT");
33 | IElementType INTEGER = new RONTokenType("INTEGER");
34 | IElementType PARENTHESISL = new RONTokenType("(");
35 | IElementType PARENTHESISR = new RONTokenType(")");
36 | IElementType RAW_STRING = new RONTokenType("RAW STRING");
37 | IElementType SOME = new RONTokenType("Some");
38 | IElementType STRING = new RONTokenType("STRING");
39 |
40 | class Factory {
41 | public static PsiElement createElement(ASTNode node) {
42 | IElementType type = node.getElementType();
43 | if (type == BOOL) {
44 | return new RONBoolImpl(node);
45 | }
46 | else if (type == LIST) {
47 | return new RONListImpl(node);
48 | }
49 | else if (type == MAP) {
50 | return new RONMapImpl(node);
51 | }
52 | else if (type == MAP_ENTRY) {
53 | return new RONMapEntryImpl(node);
54 | }
55 | else if (type == NAMED_FIELD) {
56 | return new RONNamedFieldImpl(node);
57 | }
58 | else if (type == OBJECT) {
59 | return new RONObjectImpl(node);
60 | }
61 | else if (type == OPTION) {
62 | return new RONOptionImpl(node);
63 | }
64 | else if (type == VALUE) {
65 | return new RONValueImpl(node);
66 | }
67 | throw new AssertionError("Unknown element type: " + type);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon_dark.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 |
88 | @rem Execute Gradle
89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
90 |
91 | :end
92 | @rem End local scope for the variables with windows NT shell
93 | if "%ERRORLEVEL%"=="0" goto mainEnd
94 |
95 | :fail
96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
97 | rem the _cmd.exe /c_ return code!
98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
99 | exit /b 1
100 |
101 | :mainEnd
102 | if "%OS%"=="Windows_NT" endlocal
103 |
104 | :omega
105 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/__RONLexer.flex:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language;
2 |
3 | import com.intellij.lexer.FlexLexer;
4 | import com.intellij.psi.tree.IElementType;
5 |
6 | import static com.intellij.psi.TokenType.BAD_CHARACTER;
7 | import static com.intellij.psi.TokenType.WHITE_SPACE;
8 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
9 |
10 | %%
11 |
12 | %{
13 | public __RONLexer() {
14 | this((java.io.Reader)null);
15 | }
16 | %}
17 |
18 | %{
19 | private int zzShaStride = -1;
20 |
21 | private int zzPostponedMarkedPos = -1;
22 | %}
23 |
24 | %{
25 | IElementType imbueRawLiteral() {
26 | yybegin(YYINITIAL);
27 |
28 | zzStartRead = zzPostponedMarkedPos;
29 | zzShaStride = -1;
30 | zzPostponedMarkedPos = -1;
31 |
32 | return RAW_STRING;
33 | }
34 |
35 | IElementType imbueBlockComment() {
36 | yybegin(YYINITIAL);
37 |
38 | zzStartRead = zzPostponedMarkedPos;
39 | zzPostponedMarkedPos = -1;
40 |
41 | return BLOCK_COMMENT;
42 | }
43 | %}
44 |
45 | %public
46 | %class __RONLexer
47 | %implements FlexLexer
48 | %function advance
49 | %type IElementType
50 |
51 | %s IN_RAW_STRING
52 | %s IN_RAW_STRING_SUFFIX
53 |
54 | %s IN_BLOCK_COMMENT
55 |
56 | %unicode
57 |
58 | EOL=\R
59 | WHITE_SPACE=\s+
60 |
61 | BOOLEAN=true|false
62 | IDENT=[A-Za-z_]+
63 | INTEGER=[+-]?((0x[0-9A-Fa-f][0-9A-Fa-f_]*)|((0[bo]?)?[0-9][0-9_]*))
64 | FLOAT=([+-]?[0-9]+\.[0-9]*([Ee][0-9]+)?)|(\.[0-9]+([Ee][0-9]+)?)
65 | CHAR='([ -&(-\[\]-~])|(\')|(\\\\)'
66 | STRING=\"([^\r\n\"]|(\\[\S]))*\"
67 | EXTENSION=#!\[enable\([A-Za-z_]+\)\]
68 | COMMENT="//".*
69 |
70 | %%
71 | {
72 | "(" { return PARENTHESISL; }
73 | ")" { return PARENTHESISR; }
74 | "[" { return BRACKETL; }
75 | "]" { return BRACKETR; }
76 | "{" { return BRACEL; }
77 | "}" { return BRACER; }
78 | ":" { return COLON; }
79 | "," { return COMMA; }
80 | "Some" { return SOME; }
81 |
82 | "r" #* \" {
83 | yybegin(IN_RAW_STRING);
84 | zzPostponedMarkedPos = zzStartRead;
85 | zzShaStride = yylength() - 2;
86 | }
87 |
88 | {BOOLEAN} { return BOOLEAN; }
89 | {IDENT} { return IDENT; }
90 | {INTEGER} { return INTEGER; }
91 | {FLOAT} { return FLOAT; }
92 | {CHAR} { return CHAR; }
93 | {STRING} { return STRING; }
94 | {EXTENSION} { return EXTENSION; }
95 | {COMMENT} { return COMMENT; }
96 | "/*" {
97 | yybegin(IN_BLOCK_COMMENT);
98 | yypushback(2);
99 | }
100 |
101 | {WHITE_SPACE} { return WHITE_SPACE; }
102 | }
103 |
104 | {
105 | \" #* { int shaExcess = yylength() - 1 - zzShaStride; if (shaExcess >= 0) { yybegin(IN_RAW_STRING_SUFFIX); yypushback(shaExcess); } }
106 | [^] { }
107 | <> { return imbueRawLiteral(); }
108 | }
109 |
110 | {
111 | [^] { yypushback(1); return imbueRawLiteral(); }
112 | <> { return imbueRawLiteral(); }
113 | }
114 |
115 | {
116 | "*/" { return imbueBlockComment(); }
117 | <> { return imbueBlockComment(); }
118 | [^] { }
119 | }
120 |
121 | [^] { return BAD_CHARACTER; }
122 |
--------------------------------------------------------------------------------
/src/main/java/org/jonahhenriksson/ron/language/RONSyntaxHighlighter.java:
--------------------------------------------------------------------------------
1 | package org.jonahhenriksson.ron.language;
2 |
3 | import com.intellij.lexer.Lexer;
4 | import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
5 | import com.intellij.openapi.editor.HighlighterColors;
6 | import com.intellij.openapi.editor.colors.TextAttributesKey;
7 | import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
8 | import com.intellij.psi.TokenType;
9 | import com.intellij.psi.tree.IElementType;
10 | import org.jetbrains.annotations.NotNull;
11 | import org.jonahhenriksson.ron.language.psi.RONTypes;
12 |
13 | public class RONSyntaxHighlighter extends SyntaxHighlighterBase {
14 |
15 | public static final TextAttributesKey COLON = TextAttributesKey.createTextAttributesKey("RON_COLON", DefaultLanguageHighlighterColors.OPERATION_SIGN);
16 | public static final TextAttributesKey COMMA = TextAttributesKey.createTextAttributesKey("RON_COMMA", DefaultLanguageHighlighterColors.COMMA);
17 | public static final TextAttributesKey PARENTHESES = TextAttributesKey.createTextAttributesKey("RON_PARENTHESES", DefaultLanguageHighlighterColors.PARENTHESES);
18 | public static final TextAttributesKey BRACKETS = TextAttributesKey.createTextAttributesKey("RON_BRACKETS", DefaultLanguageHighlighterColors.BRACKETS);
19 | public static final TextAttributesKey BRACES = TextAttributesKey.createTextAttributesKey("RON_BRACES", DefaultLanguageHighlighterColors.BRACES);
20 | public static final TextAttributesKey BOOLEAN = TextAttributesKey.createTextAttributesKey("RON_BOOLEAN", DefaultLanguageHighlighterColors.KEYWORD);
21 | public static final TextAttributesKey NUMBER = TextAttributesKey.createTextAttributesKey("RON_NUMBER", DefaultLanguageHighlighterColors.NUMBER);
22 | public static final TextAttributesKey STRING = TextAttributesKey.createTextAttributesKey("RON_STRING", DefaultLanguageHighlighterColors.STRING);
23 | public static final TextAttributesKey OPTION = TextAttributesKey.createTextAttributesKey("RON_OPTION", DefaultLanguageHighlighterColors.KEYWORD);
24 | public static final TextAttributesKey EXTENSION = TextAttributesKey.createTextAttributesKey("RON_EXTENSION", DefaultLanguageHighlighterColors.METADATA);
25 | public static final TextAttributesKey IDENT = TextAttributesKey.createTextAttributesKey("RON_IDENT", DefaultLanguageHighlighterColors.IDENTIFIER);
26 | public static final TextAttributesKey COMMENT = TextAttributesKey.createTextAttributesKey("RON_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
27 | public static final TextAttributesKey BAD_CHAR = TextAttributesKey.createTextAttributesKey("RON_BAD_CHAR", HighlighterColors.BAD_CHARACTER);
28 |
29 | private static final TextAttributesKey[] COLON_KEYS = new TextAttributesKey[]{COLON};
30 | private static final TextAttributesKey[] COMMA_KEYS = new TextAttributesKey[]{COMMA};
31 | private static final TextAttributesKey[] PARENTHESES_KEYS = new TextAttributesKey[]{PARENTHESES};
32 | private static final TextAttributesKey[] BRACKETS_KEYS = new TextAttributesKey[]{BRACKETS};
33 | private static final TextAttributesKey[] BRACES_KEYS = new TextAttributesKey[]{BRACES};
34 | private static final TextAttributesKey[] BOOLEAN_KEYS = new TextAttributesKey[]{BOOLEAN};
35 | private static final TextAttributesKey[] NUMBER_KEYS = new TextAttributesKey[]{NUMBER};
36 | private static final TextAttributesKey[] STRING_KEYS = new TextAttributesKey[]{STRING};
37 | private static final TextAttributesKey[] OPTION_KEYS = new TextAttributesKey[]{OPTION};
38 | private static final TextAttributesKey[] EXTENSION_KEYS = new TextAttributesKey[]{EXTENSION};
39 | private static final TextAttributesKey[] IDENT_KEYS = new TextAttributesKey[]{IDENT};
40 | private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENT};
41 | private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHAR};
42 | private static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0];
43 |
44 | @Override
45 | public @NotNull Lexer getHighlightingLexer() {
46 | return new RONLexerAdapter();
47 | }
48 |
49 | @Override
50 | public @NotNull TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
51 | if (tokenType.equals(RONTypes.COLON)) {
52 | return COLON_KEYS;
53 | }
54 | else if (tokenType.equals(RONTypes.COMMA)) {
55 | return COMMA_KEYS;
56 | }
57 | else if (tokenType.equals(RONTypes.PARENTHESISL) || tokenType.equals(RONTypes.PARENTHESISR)) {
58 | return PARENTHESES_KEYS;
59 | }
60 | else if (tokenType.equals(RONTypes.BRACKETL) || tokenType.equals(RONTypes.BRACKETR)) {
61 | return BRACKETS_KEYS;
62 | }
63 | else if (tokenType.equals(RONTypes.BRACEL) || tokenType.equals(RONTypes.BRACER)) {
64 | return BRACES_KEYS;
65 | }
66 | else if (tokenType.equals(RONTypes.BOOLEAN)) {
67 | return BOOLEAN_KEYS;
68 | }
69 | else if (tokenType.equals(RONTypes.INTEGER)|| tokenType.equals(RONTypes.FLOAT)) {
70 | return NUMBER_KEYS;
71 | }
72 | else if (tokenType.equals(RONTypes.STRING) || tokenType.equals(RONTypes.RAW_STRING)) {
73 | return STRING_KEYS;
74 | }
75 | else if (tokenType.equals(RONTypes.SOME)) {
76 | return OPTION_KEYS;
77 | }
78 | else if (tokenType.equals(RONTypes.EXTENSION)) {
79 | return EXTENSION_KEYS;
80 | }
81 | else if (tokenType.equals(RONTypes.IDENT)) {
82 | return IDENT_KEYS;
83 | }
84 | else if (tokenType.equals(RONTypes.COMMENT) || tokenType.equals(RONTypes.BLOCK_COMMENT)) {
85 | return COMMENT_KEYS;
86 | }
87 | else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
88 | return BAD_CHAR_KEYS;
89 | }
90 | else {
91 | return EMPTY_KEYS;
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/src/main/resources/flex/idea-flex.skeleton:
--------------------------------------------------------------------------------
1 |
2 | /** This character denotes the end of file */
3 | public static final int YYEOF = -1;
4 |
5 | /** initial size of the lookahead buffer */
6 | --- private static final int ZZ_BUFFERSIZE = ...;
7 |
8 | /** lexical states */
9 | --- lexical states, charmap
10 |
11 | /* error codes */
12 | private static final int ZZ_UNKNOWN_ERROR = 0;
13 | private static final int ZZ_NO_MATCH = 1;
14 | private static final int ZZ_PUSHBACK_2BIG = 2;
15 |
16 | /* error messages for the codes above */
17 | private static final String[] ZZ_ERROR_MSG = {
18 | "Unknown internal scanner error",
19 | "Error: could not match input",
20 | "Error: pushback value was too large"
21 | };
22 |
23 | --- isFinal list
24 | /** the input device */
25 | private java.io.Reader zzReader;
26 |
27 | /** the current state of the DFA */
28 | private int zzState;
29 |
30 | /** the current lexical state */
31 | private int zzLexicalState = YYINITIAL;
32 |
33 | /** this buffer contains the current text to be matched and is
34 | the source of the yytext() string */
35 | private CharSequence zzBuffer = "";
36 |
37 | /** the textposition at the last accepting state */
38 | private int zzMarkedPos;
39 |
40 | /** the current text position in the buffer */
41 | private int zzCurrentPos;
42 |
43 | /** startRead marks the beginning of the yytext() string in the buffer */
44 | private int zzStartRead;
45 |
46 | /** endRead marks the last character in the buffer, that has been read
47 | from input */
48 | private int zzEndRead;
49 |
50 | /**
51 | * zzAtBOL == true <=> the scanner is currently at the beginning of a line
52 | */
53 | private boolean zzAtBOL = true;
54 |
55 | /** zzAtEOF == true <=> the scanner is at the EOF */
56 | private boolean zzAtEOF;
57 |
58 | /** denotes if the user-EOF-code has already been executed */
59 | private boolean zzEOFDone;
60 |
61 | --- user class code
62 |
63 | --- constructor declaration
64 |
65 | public final int getTokenStart() {
66 | return zzStartRead;
67 | }
68 |
69 | public final int getTokenEnd() {
70 | return getTokenStart() + yylength();
71 | }
72 |
73 | public void reset(CharSequence buffer, int start, int end, int initialState) {
74 | zzBuffer = buffer;
75 | zzCurrentPos = zzMarkedPos = zzStartRead = start;
76 | zzAtEOF = false;
77 | zzAtBOL = true;
78 | zzEndRead = end;
79 | yybegin(initialState);
80 | }
81 |
82 | /**
83 | * Refills the input buffer.
84 | *
85 | * @return {@code false}, iff there was new input.
86 | *
87 | * @exception java.io.IOException if any I/O-Error occurs
88 | */
89 | private boolean zzRefill() throws java.io.IOException {
90 | return true;
91 | }
92 |
93 |
94 | /**
95 | * Returns the current lexical state.
96 | */
97 | public final int yystate() {
98 | return zzLexicalState;
99 | }
100 |
101 |
102 | /**
103 | * Enters a new lexical state
104 | *
105 | * @param newState the new lexical state
106 | */
107 | public final void yybegin(int newState) {
108 | zzLexicalState = newState;
109 | }
110 |
111 |
112 | /**
113 | * Returns the text matched by the current regular expression.
114 | */
115 | public final CharSequence yytext() {
116 | return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
117 | }
118 |
119 |
120 | /**
121 | * Returns the character at position {@code pos} from the
122 | * matched text.
123 | *
124 | * It is equivalent to yytext().charAt(pos), but faster
125 | *
126 | * @param pos the position of the character to fetch.
127 | * A value from 0 to yylength()-1.
128 | *
129 | * @return the character at position pos
130 | */
131 | public final char yycharat(int pos) {
132 | return zzBuffer.charAt(zzStartRead+pos);
133 | }
134 |
135 |
136 | /**
137 | * Returns the length of the matched text region.
138 | */
139 | public final int yylength() {
140 | return zzMarkedPos-zzStartRead;
141 | }
142 |
143 |
144 | /**
145 | * Reports an error that occurred while scanning.
146 | *
147 | * In a wellformed scanner (no or only correct usage of
148 | * yypushback(int) and a match-all fallback rule) this method
149 | * will only be called with things that "Can't Possibly Happen".
150 | * If this method is called, something is seriously wrong
151 | * (e.g. a JFlex bug producing a faulty scanner etc.).
152 | *
153 | * Usual syntax/scanner level error handling should be done
154 | * in error fallback rules.
155 | *
156 | * @param errorCode the code of the errormessage to display
157 | */
158 | --- zzScanError declaration
159 | String message;
160 | try {
161 | message = ZZ_ERROR_MSG[errorCode];
162 | }
163 | catch (ArrayIndexOutOfBoundsException e) {
164 | message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
165 | }
166 |
167 | --- throws clause
168 | }
169 |
170 |
171 | /**
172 | * Pushes the specified amount of characters back into the input stream.
173 | *
174 | * They will be read again by then next call of the scanning method
175 | *
176 | * @param number the number of characters to be read again.
177 | * This number must not be greater than yylength()!
178 | */
179 | --- yypushback decl (contains zzScanError exception)
180 | if ( number > yylength() )
181 | zzScanError(ZZ_PUSHBACK_2BIG);
182 |
183 | zzMarkedPos -= number;
184 | }
185 |
186 |
187 | --- zzDoEOF
188 | /**
189 | * Resumes scanning until the next regular expression is matched,
190 | * the end of input is encountered or an I/O-Error occurs.
191 | *
192 | * @return the next token
193 | * @exception java.io.IOException if any I/O-Error occurs
194 | */
195 | --- yylex declaration
196 | int zzInput;
197 | int zzAction;
198 |
199 | // cached fields:
200 | int zzCurrentPosL;
201 | int zzMarkedPosL;
202 | int zzEndReadL = zzEndRead;
203 | CharSequence zzBufferL = zzBuffer;
204 |
205 | --- local declarations
206 |
207 | while (true) {
208 | zzMarkedPosL = zzMarkedPos;
209 |
210 | --- start admin (line, char, col count)
211 | zzAction = -1;
212 |
213 | zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
214 |
215 | --- start admin (lexstate etc)
216 |
217 | zzForAction: {
218 | while (true) {
219 |
220 | --- next input, line, col, char count, next transition, isFinal action
221 | zzAction = zzState;
222 | zzMarkedPosL = zzCurrentPosL;
223 | --- line count update
224 | }
225 |
226 | }
227 | }
228 |
229 | // store back cached position
230 | zzMarkedPos = zzMarkedPosL;
231 | --- char count update
232 |
233 | if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
234 | zzAtEOF = true;
235 | --- eofvalue
236 | }
237 | else {
238 | --- actions
239 | default:
240 | --- no match
241 | }
242 | }
243 | }
244 | }
245 |
246 | --- main
247 |
248 | }
249 |
--------------------------------------------------------------------------------
/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/src/main/gen/org/jonahhenriksson/ron/language/parser/_RONParser.java:
--------------------------------------------------------------------------------
1 | // This is a generated file. Not intended for manual editing.
2 | package org.jonahhenriksson.ron.language.parser;
3 |
4 | import com.intellij.lang.PsiBuilder;
5 | import com.intellij.lang.PsiBuilder.Marker;
6 | import static org.jonahhenriksson.ron.language.psi.RONTypes.*;
7 | import static org.jonahhenriksson.ron.language.psi.RONParserUtil.*;
8 | import com.intellij.psi.tree.IElementType;
9 | import com.intellij.lang.ASTNode;
10 | import com.intellij.psi.tree.TokenSet;
11 | import com.intellij.lang.PsiParser;
12 | import com.intellij.lang.LightPsiParser;
13 |
14 | @SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
15 | public class _RONParser implements PsiParser, LightPsiParser {
16 |
17 | public ASTNode parse(IElementType t, PsiBuilder b) {
18 | parseLight(t, b);
19 | return b.getTreeBuilt();
20 | }
21 |
22 | public void parseLight(IElementType t, PsiBuilder b) {
23 | boolean r;
24 | b = adapt_builder_(t, b, this, null);
25 | Marker m = enter_section_(b, 0, _COLLAPSE_, null);
26 | r = parse_root_(t, b);
27 | exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
28 | }
29 |
30 | protected boolean parse_root_(IElementType t, PsiBuilder b) {
31 | return parse_root_(t, b, 0);
32 | }
33 |
34 | static boolean parse_root_(IElementType t, PsiBuilder b, int l) {
35 | return RON(b, l + 1);
36 | }
37 |
38 | /* ********************************************************** */
39 | // [extension+] value
40 | static boolean RON(PsiBuilder b, int l) {
41 | if (!recursion_guard_(b, l, "RON")) return false;
42 | boolean r;
43 | Marker m = enter_section_(b);
44 | r = RON_0(b, l + 1);
45 | r = r && value(b, l + 1);
46 | exit_section_(b, m, null, r);
47 | return r;
48 | }
49 |
50 | // [extension+]
51 | private static boolean RON_0(PsiBuilder b, int l) {
52 | if (!recursion_guard_(b, l, "RON_0")) return false;
53 | RON_0_0(b, l + 1);
54 | return true;
55 | }
56 |
57 | // extension+
58 | private static boolean RON_0_0(PsiBuilder b, int l) {
59 | if (!recursion_guard_(b, l, "RON_0_0")) return false;
60 | boolean r;
61 | Marker m = enter_section_(b);
62 | r = extension(b, l + 1);
63 | while (r) {
64 | int c = current_position_(b);
65 | if (!extension(b, l + 1)) break;
66 | if (!empty_element_parsed_guard_(b, "RON_0_0", c)) break;
67 | }
68 | exit_section_(b, m, null, r);
69 | return r;
70 | }
71 |
72 | /* ********************************************************** */
73 | // BOOLEAN
74 | public static boolean bool(PsiBuilder b, int l) {
75 | if (!recursion_guard_(b, l, "bool")) return false;
76 | if (!nextTokenIs(b, BOOLEAN)) return false;
77 | boolean r;
78 | Marker m = enter_section_(b);
79 | r = consumeToken(b, BOOLEAN);
80 | exit_section_(b, m, BOOL, r);
81 | return r;
82 | }
83 |
84 | /* ********************************************************** */
85 | // CHAR
86 | static boolean char_$(PsiBuilder b, int l) {
87 | return consumeToken(b, CHAR);
88 | }
89 |
90 | /* ********************************************************** */
91 | // EXTENSION
92 | static boolean extension(PsiBuilder b, int l) {
93 | return consumeToken(b, EXTENSION);
94 | }
95 |
96 | /* ********************************************************** */
97 | // FLOAT
98 | static boolean float_$(PsiBuilder b, int l) {
99 | return consumeToken(b, FLOAT);
100 | }
101 |
102 | /* ********************************************************** */
103 | // INTEGER
104 | static boolean integer(PsiBuilder b, int l) {
105 | return consumeToken(b, INTEGER);
106 | }
107 |
108 | /* ********************************************************** */
109 | // BRACKETL [value (COMMA value)* [COMMA]] BRACKETR
110 | public static boolean list(PsiBuilder b, int l) {
111 | if (!recursion_guard_(b, l, "list")) return false;
112 | if (!nextTokenIs(b, BRACKETL)) return false;
113 | boolean r;
114 | Marker m = enter_section_(b);
115 | r = consumeToken(b, BRACKETL);
116 | r = r && list_1(b, l + 1);
117 | r = r && consumeToken(b, BRACKETR);
118 | exit_section_(b, m, LIST, r);
119 | return r;
120 | }
121 |
122 | // [value (COMMA value)* [COMMA]]
123 | private static boolean list_1(PsiBuilder b, int l) {
124 | if (!recursion_guard_(b, l, "list_1")) return false;
125 | list_1_0(b, l + 1);
126 | return true;
127 | }
128 |
129 | // value (COMMA value)* [COMMA]
130 | private static boolean list_1_0(PsiBuilder b, int l) {
131 | if (!recursion_guard_(b, l, "list_1_0")) return false;
132 | boolean r;
133 | Marker m = enter_section_(b);
134 | r = value(b, l + 1);
135 | r = r && list_1_0_1(b, l + 1);
136 | r = r && list_1_0_2(b, l + 1);
137 | exit_section_(b, m, null, r);
138 | return r;
139 | }
140 |
141 | // (COMMA value)*
142 | private static boolean list_1_0_1(PsiBuilder b, int l) {
143 | if (!recursion_guard_(b, l, "list_1_0_1")) return false;
144 | while (true) {
145 | int c = current_position_(b);
146 | if (!list_1_0_1_0(b, l + 1)) break;
147 | if (!empty_element_parsed_guard_(b, "list_1_0_1", c)) break;
148 | }
149 | return true;
150 | }
151 |
152 | // COMMA value
153 | private static boolean list_1_0_1_0(PsiBuilder b, int l) {
154 | if (!recursion_guard_(b, l, "list_1_0_1_0")) return false;
155 | boolean r;
156 | Marker m = enter_section_(b);
157 | r = consumeToken(b, COMMA);
158 | r = r && value(b, l + 1);
159 | exit_section_(b, m, null, r);
160 | return r;
161 | }
162 |
163 | // [COMMA]
164 | private static boolean list_1_0_2(PsiBuilder b, int l) {
165 | if (!recursion_guard_(b, l, "list_1_0_2")) return false;
166 | consumeToken(b, COMMA);
167 | return true;
168 | }
169 |
170 | /* ********************************************************** */
171 | // BRACEL [map_entry (COMMA map_entry)* [COMMA]] BRACER
172 | public static boolean map(PsiBuilder b, int l) {
173 | if (!recursion_guard_(b, l, "map")) return false;
174 | if (!nextTokenIs(b, BRACEL)) return false;
175 | boolean r;
176 | Marker m = enter_section_(b);
177 | r = consumeToken(b, BRACEL);
178 | r = r && map_1(b, l + 1);
179 | r = r && consumeToken(b, BRACER);
180 | exit_section_(b, m, MAP, r);
181 | return r;
182 | }
183 |
184 | // [map_entry (COMMA map_entry)* [COMMA]]
185 | private static boolean map_1(PsiBuilder b, int l) {
186 | if (!recursion_guard_(b, l, "map_1")) return false;
187 | map_1_0(b, l + 1);
188 | return true;
189 | }
190 |
191 | // map_entry (COMMA map_entry)* [COMMA]
192 | private static boolean map_1_0(PsiBuilder b, int l) {
193 | if (!recursion_guard_(b, l, "map_1_0")) return false;
194 | boolean r;
195 | Marker m = enter_section_(b);
196 | r = map_entry(b, l + 1);
197 | r = r && map_1_0_1(b, l + 1);
198 | r = r && map_1_0_2(b, l + 1);
199 | exit_section_(b, m, null, r);
200 | return r;
201 | }
202 |
203 | // (COMMA map_entry)*
204 | private static boolean map_1_0_1(PsiBuilder b, int l) {
205 | if (!recursion_guard_(b, l, "map_1_0_1")) return false;
206 | while (true) {
207 | int c = current_position_(b);
208 | if (!map_1_0_1_0(b, l + 1)) break;
209 | if (!empty_element_parsed_guard_(b, "map_1_0_1", c)) break;
210 | }
211 | return true;
212 | }
213 |
214 | // COMMA map_entry
215 | private static boolean map_1_0_1_0(PsiBuilder b, int l) {
216 | if (!recursion_guard_(b, l, "map_1_0_1_0")) return false;
217 | boolean r;
218 | Marker m = enter_section_(b);
219 | r = consumeToken(b, COMMA);
220 | r = r && map_entry(b, l + 1);
221 | exit_section_(b, m, null, r);
222 | return r;
223 | }
224 |
225 | // [COMMA]
226 | private static boolean map_1_0_2(PsiBuilder b, int l) {
227 | if (!recursion_guard_(b, l, "map_1_0_2")) return false;
228 | consumeToken(b, COMMA);
229 | return true;
230 | }
231 |
232 | /* ********************************************************** */
233 | // value COLON value
234 | public static boolean map_entry(PsiBuilder b, int l) {
235 | if (!recursion_guard_(b, l, "map_entry")) return false;
236 | boolean r;
237 | Marker m = enter_section_(b, l, _NONE_, MAP_ENTRY, "