yapp 2.2.182 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.js +104 -450
- package/lib/colours.js +2 -6
- package/lib/example/view.js +3 -8
- package/lib/index.js +1 -9
- package/lib/lexer/javascript.js +6 -18
- package/lib/lexer/json.js +7 -20
- package/lib/lexer/plainText.js +7 -20
- package/lib/lexer/xml.js +6 -18
- package/lib/parser/javascript.js +10 -19
- package/lib/parser/json.js +10 -19
- package/lib/parser/plainText.js +10 -19
- package/lib/parser/xml.js +10 -19
- package/lib/plugin/javascript.js +3 -5
- package/lib/plugin/json.js +3 -5
- package/lib/plugin/plainText.js +3 -5
- package/lib/plugin/xml.js +3 -5
- package/lib/plugin.js +3 -2
- package/lib/scheme/syntax/javaScript.js +2 -2
- package/package.json +2 -2
- package/src/colours.js +1 -2
- package/src/example/view.js +7 -14
- package/src/index.js +0 -2
- package/src/lexer/javascript.js +5 -8
- package/src/lexer/json.js +5 -8
- package/src/lexer/plainText.js +5 -9
- package/src/lexer/xml.js +4 -7
- package/src/parser/javascript.js +144 -142
- package/src/parser/json.js +16 -14
- package/src/parser/plainText.js +10 -8
- package/src/parser/xml.js +24 -22
- package/src/plugin/javascript.js +1 -1
- package/src/plugin/json.js +1 -1
- package/src/plugin/plainText.js +1 -1
- package/src/plugin/xml.js +1 -1
- package/src/plugin.js +5 -1
- package/src/scheme/syntax/javaScript.js +2 -2
- package/lib/lexer/yapp.js +0 -93
- package/lib/parser/yapp.js +0 -132
- package/src/lexer/yapp.js +0 -5
- package/src/parser/yapp.js +0 -29
package/src/colours.js
CHANGED
|
@@ -11,7 +11,6 @@ export const tuatara = "#363534";
|
|
|
11
11
|
export const woodsmoke = "#0c0d0f";
|
|
12
12
|
|
|
13
13
|
export const citron = "#86b923";
|
|
14
|
-
export const sushi = "#7fa82f";
|
|
15
14
|
export const oliveDrab = "#6B9825";
|
|
16
15
|
export const rifleGreen = "#414833";
|
|
17
16
|
export const logCabin = "#24301d";
|
|
@@ -28,5 +27,5 @@ export const tahiti = "#F58A0A";
|
|
|
28
27
|
export const equator = "#e4aC5e";
|
|
29
28
|
|
|
30
29
|
export const portica = "#f7e75f";
|
|
31
|
-
export const celery = "#
|
|
30
|
+
export const celery = "#b7b231";
|
|
32
31
|
export const sycamore = "#908d39";
|
package/src/example/view.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import { Element } from "easy";
|
|
6
|
-
import {
|
|
7
|
-
import { BNFParser } from "occam-parsers";
|
|
8
|
-
import { eliminateLeftRecursion, rewriteNodes } from "occam-grammar-utilities";
|
|
6
|
+
import { rewriteNodes, parserUtilities } from "occam-grammar-utilities";
|
|
9
7
|
import { RowDiv, RowsDiv, ColumnDiv, ColumnsDiv, VerticalSplitterDiv, HorizontalSplitterDiv } from "easy-layout";
|
|
10
8
|
|
|
11
9
|
import Yapp from "./yapp";
|
|
@@ -19,8 +17,7 @@ import MiddleSizeableDiv from "./div/sizeable/middle";
|
|
|
19
17
|
import ParseTreeTextarea from "./textarea/parseTree";
|
|
20
18
|
import LexicalEntriesTextarea from "./textarea/lexicalEntries";
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
bnfParser = BNFParser.fromNothing();
|
|
20
|
+
const { rulesFromBNF } = parserUtilities;
|
|
24
21
|
|
|
25
22
|
class View extends Element {
|
|
26
23
|
contentChangeHandler(event, element) {
|
|
@@ -29,17 +26,12 @@ class View extends Element {
|
|
|
29
26
|
|
|
30
27
|
keyUpHandler(event, element) {
|
|
31
28
|
try {
|
|
32
|
-
const lexicalEntries = this.getLexicalEntries(),
|
|
33
|
-
entries = lexicalEntries, ///
|
|
34
|
-
bnf = this.getBNF(),
|
|
35
|
-
tokens = bnfLexer.tokensFromBNF(bnf);
|
|
36
|
-
|
|
37
|
-
let rules = bnfParser.rulesFromTokens(tokens);
|
|
38
|
-
|
|
39
|
-
rules = eliminateLeftRecursion(rules);
|
|
40
|
-
|
|
41
29
|
const { Plugin } = this.constructor,
|
|
42
30
|
{ Lexer, Parser } = Plugin,
|
|
31
|
+
lexicalEntries = this.getLexicalEntries(),
|
|
32
|
+
bnf = this.getBNF(),
|
|
33
|
+
entries = lexicalEntries, ///
|
|
34
|
+
rules = rulesFromBNF(bnf),
|
|
43
35
|
lexer = Lexer.fromEntries(entries),
|
|
44
36
|
parser = Parser.fromRules(rules),
|
|
45
37
|
yappLexer = lexer, ///
|
|
@@ -64,6 +56,7 @@ class View extends Element {
|
|
|
64
56
|
yappHeight = topSizeableDivHeight; ///
|
|
65
57
|
|
|
66
58
|
this.setYappWidth(yappWidth);
|
|
59
|
+
|
|
67
60
|
this.setYappHeight(yappHeight);
|
|
68
61
|
|
|
69
62
|
this.resizeYapp();
|
package/src/index.js
CHANGED
|
@@ -4,8 +4,6 @@ import Yapp from "./yapp";
|
|
|
4
4
|
|
|
5
5
|
export default Yapp;
|
|
6
6
|
|
|
7
|
-
export { default as YappLexer } from "./lexer/yapp";
|
|
8
|
-
export { default as YappParser } from "./parser/yapp";
|
|
9
7
|
export { default as syntaxStyle } from "./style/syntax";
|
|
10
8
|
export { default as colourScheme } from "./scheme/colour";
|
|
11
9
|
export { default as firaCodeStyle } from "./style/firaCode";
|
package/src/lexer/javascript.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CommonLexer,
|
|
4
|
+
WhitespaceToken,
|
|
4
5
|
EndOfLineNonSignificantToken,
|
|
5
6
|
CStyleSingleLineCommentToken,
|
|
6
7
|
SinglyQuotedStringLiteralToken,
|
|
@@ -10,8 +11,6 @@ import { WhitespaceToken,
|
|
|
10
11
|
CStyleMiddleOfMultiLineCommentToken,
|
|
11
12
|
EndOfLineCommentNonSignificantToken } from "occam-lexers";
|
|
12
13
|
|
|
13
|
-
import YappLexer from "../lexer/yapp";
|
|
14
|
-
|
|
15
14
|
const entries = [
|
|
16
15
|
{
|
|
17
16
|
"delimiter": "^(?:`|\\$\\{|<\\/|\\/>)"
|
|
@@ -36,7 +35,7 @@ const entries = [
|
|
|
36
35
|
}
|
|
37
36
|
];
|
|
38
37
|
|
|
39
|
-
export default class JavaScriptLexer extends
|
|
38
|
+
export default class JavaScriptLexer extends CommonLexer {
|
|
40
39
|
static entries = entries;
|
|
41
40
|
|
|
42
41
|
static EndOfLineToken = EndOfLineNonSignificantToken; ///
|
|
@@ -59,9 +58,7 @@ export default class JavaScriptLexer extends YappLexer {
|
|
|
59
58
|
|
|
60
59
|
static DoublyQuotedStringLiteralToken = DoublyQuotedStringLiteralToken;
|
|
61
60
|
|
|
62
|
-
static fromNothing() { return
|
|
63
|
-
|
|
64
|
-
static fromRules(rules) { return YappLexer.fromRules(JavaScriptLexer, rules); }
|
|
61
|
+
static fromNothing() { return CommonLexer.fromNothing(JavaScriptLexer); }
|
|
65
62
|
|
|
66
|
-
static fromEntries(entries) { return
|
|
63
|
+
static fromEntries(entries) { return CommonLexer.fromEntries(JavaScriptLexer, entries); }
|
|
67
64
|
}
|
package/src/lexer/json.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { WhitespaceToken, EndOfLineNonSignificantToken, DoublyQuotedStringLiteralToken, EndOfLineCommentNonSignificantToken } from "occam-lexers";
|
|
3
|
+
import { CommonLexer, WhitespaceToken, EndOfLineNonSignificantToken, DoublyQuotedStringLiteralToken } from "occam-lexers";
|
|
5
4
|
|
|
6
5
|
const entries = [
|
|
7
6
|
{
|
|
@@ -18,14 +17,14 @@ const entries = [
|
|
|
18
17
|
}
|
|
19
18
|
];
|
|
20
19
|
|
|
21
|
-
export default class JSONLexer extends
|
|
20
|
+
export default class JSONLexer extends CommonLexer {
|
|
22
21
|
static entries = entries;
|
|
23
22
|
|
|
24
23
|
static EndOfLineToken = EndOfLineNonSignificantToken; ///
|
|
25
24
|
|
|
26
25
|
static WhitespaceToken = WhitespaceToken;
|
|
27
26
|
|
|
28
|
-
static EndOfLineCommentToken =
|
|
27
|
+
static EndOfLineCommentToken = null;
|
|
29
28
|
|
|
30
29
|
static SingleLineCommentToken = null;
|
|
31
30
|
|
|
@@ -41,9 +40,7 @@ export default class JSONLexer extends YappLexer {
|
|
|
41
40
|
|
|
42
41
|
static DoublyQuotedStringLiteralToken = DoublyQuotedStringLiteralToken;
|
|
43
42
|
|
|
44
|
-
static fromNothing() { return
|
|
43
|
+
static fromNothing() { return CommonLexer.fromNothing(JSONLexer); }
|
|
45
44
|
|
|
46
|
-
static
|
|
47
|
-
|
|
48
|
-
static fromEntries(entries) { return YappLexer.fromEntries(JSONLexer, entries); }
|
|
45
|
+
static fromEntries(entries) { return CommonLexer.fromEntries(JSONLexer, entries); }
|
|
49
46
|
}
|
package/src/lexer/plainText.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { WhitespaceToken, EndOfLineNonSignificantToken
|
|
4
|
-
|
|
5
|
-
import YappLexer from "../lexer/yapp";
|
|
3
|
+
import { CommonLexer, WhitespaceToken, EndOfLineNonSignificantToken } from "occam-lexers";
|
|
6
4
|
|
|
7
5
|
const entries = [
|
|
8
6
|
{
|
|
@@ -10,14 +8,14 @@ const entries = [
|
|
|
10
8
|
}
|
|
11
9
|
];
|
|
12
10
|
|
|
13
|
-
export default class PlainTextLexer extends
|
|
11
|
+
export default class PlainTextLexer extends CommonLexer {
|
|
14
12
|
static entries = entries;
|
|
15
13
|
|
|
16
14
|
static EndOfLineToken = EndOfLineNonSignificantToken; ///
|
|
17
15
|
|
|
18
16
|
static WhitespaceToken = WhitespaceToken;
|
|
19
17
|
|
|
20
|
-
static EndOfLineCommentToken =
|
|
18
|
+
static EndOfLineCommentToken = null;
|
|
21
19
|
|
|
22
20
|
static SingleLineCommentToken = null;
|
|
23
21
|
|
|
@@ -33,9 +31,7 @@ export default class PlainTextLexer extends YappLexer {
|
|
|
33
31
|
|
|
34
32
|
static DoublyQuotedStringLiteralToken = null;
|
|
35
33
|
|
|
36
|
-
static fromNothing() { return
|
|
37
|
-
|
|
38
|
-
static fromRules(rules) { return YappLexer.fromRules(PlainTextLexer, rules); }
|
|
34
|
+
static fromNothing() { return CommonLexer.fromNothing(PlainTextLexer); }
|
|
39
35
|
|
|
40
|
-
static fromEntries(entries) { return
|
|
36
|
+
static fromEntries(entries) { return CommonLexer.fromEntries(PlainTextLexer, entries); }
|
|
41
37
|
}
|
package/src/lexer/xml.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { WhitespaceToken, EndOfLineNonSignificantToken, DoublyQuotedStringLiteralToken } from "occam-lexers";
|
|
3
|
+
import { CommonLexer, WhitespaceToken, EndOfLineNonSignificantToken, DoublyQuotedStringLiteralToken } from "occam-lexers";
|
|
5
4
|
|
|
6
5
|
const entries = [
|
|
7
6
|
{
|
|
@@ -15,7 +14,7 @@ const entries = [
|
|
|
15
14
|
}
|
|
16
15
|
];
|
|
17
16
|
|
|
18
|
-
export default class XMLLexer extends
|
|
17
|
+
export default class XMLLexer extends CommonLexer {
|
|
19
18
|
static entries = entries;
|
|
20
19
|
|
|
21
20
|
static EndOfLineToken = EndOfLineNonSignificantToken; ///
|
|
@@ -38,9 +37,7 @@ export default class XMLLexer extends YappLexer {
|
|
|
38
37
|
|
|
39
38
|
static DoublyQuotedStringLiteralToken = DoublyQuotedStringLiteralToken;
|
|
40
39
|
|
|
41
|
-
static fromNothing() { return
|
|
40
|
+
static fromNothing() { return CommonLexer.fromNothing(XMLLexer); }
|
|
42
41
|
|
|
43
|
-
static
|
|
44
|
-
|
|
45
|
-
static fromEntries(entries) { return YappLexer.fromEntries(XMLLexer, entries); }
|
|
42
|
+
static fromEntries(entries) { return CommonLexer.fromEntries(XMLLexer, entries); }
|
|
46
43
|
}
|