Skip to content

Commit

Permalink
windows support, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigopivi committed Mar 23, 2018
1 parent 39037c1 commit 8d1e224
Show file tree
Hide file tree
Showing 9 changed files with 751 additions and 65 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
}
46 changes: 43 additions & 3 deletions core/__snapshots__/core.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,18 @@ Array [

exports[`test action without correct identation error 1`] = `
"{
\\"message\\": \\"Expected \\\\\\"%\\\\\\", \\\\\\"@\\\\\\", \\\\\\"\\\\\\\\n\\\\\\", \\\\\\"~\\\\\\", correct indentation, or end of input but \\\\\\" \\\\\\" found.\\",
\\"message\\": \\"Expected \\\\\\"%\\\\\\", \\\\\\"@\\\\\\", \\\\\\"\\\\\\\\n\\\\\\", \\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\", \\\\\\"~\\\\\\", correct indentation, or end of input but \\\\\\" \\\\\\" found.\\",
\\"expected\\": [
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"other\\",
\\"description\\": \\"correct indentation\\"
Expand All @@ -119,6 +124,11 @@ exports[`test action without correct identation error 1`] = `
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"%\\",
Expand All @@ -129,6 +139,11 @@ exports[`test action without correct identation error 1`] = `
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"@\\",
Expand All @@ -139,6 +154,11 @@ exports[`test action without correct identation error 1`] = `
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"~\\",
Expand Down Expand Up @@ -167,13 +187,18 @@ exports[`test action without correct identation error 1`] = `

exports[`test action without sentences error 1`] = `
"{
\\"message\\": \\"Expected \\\\\\"\\\\\\\\n\\\\\\" or correct indentation but end of input found.\\",
\\"message\\": \\"Expected \\\\\\"\\\\\\\\n\\\\\\", \\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\", or correct indentation but end of input found.\\",
\\"expected\\": [
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"other\\",
\\"description\\": \\"correct indentation\\"
Expand Down Expand Up @@ -251,13 +276,18 @@ exports[`test argument that defines only one alias inside each line 1`] = `

exports[`test empty parser error 1`] = `
"{
\\"message\\": \\"Expected \\\\\\"%\\\\\\", \\\\\\"@\\\\\\", \\\\\\"\\\\\\\\n\\\\\\", or \\\\\\"~\\\\\\" but end of input found.\\",
\\"message\\": \\"Expected \\\\\\"%\\\\\\", \\\\\\"@\\\\\\", \\\\\\"\\\\\\\\n\\\\\\", \\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\", or \\\\\\"~\\\\\\" but end of input found.\\",
\\"expected\\": [
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"%\\",
Expand All @@ -268,6 +298,11 @@ exports[`test empty parser error 1`] = `
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"@\\",
Expand All @@ -278,6 +313,11 @@ exports[`test empty parser error 1`] = `
\\"text\\": \\"\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"\\\\r\\\\n\\",
\\"ignoreCase\\": false
},
{
\\"type\\": \\"literal\\",
\\"text\\": \\"~\\",
Expand Down
52 changes: 38 additions & 14 deletions core/chatito.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion core/chatito.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ AnyText = v:([^ \n]+) { return v.join("") }
OptionalKeywordLiteral = id:AnyText SPACE?
{ return { id: id, type: "Text" }}
EOS = EOL / EOF
EOL = "\n"+
EOL = (EOLNonWindows/EOLWindows)+
EOLNonWindows = "\n"
EOLWindows = "\r\n"
SPACE = " "+
EOF = !.
Loading

0 comments on commit 8d1e224

Please sign in to comment.