Skip to content

Commit

Permalink
prepping for internationalization and unicode operators
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Sep 9, 2017
1 parent fea6f7b commit 51f5944
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 2,501 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,3 +1,4 @@
* [[`fea6f7b909`](https://github.com/StoneCypher/jssm/commit/fea6f7b909)] - lol whet see https://github.com/istanbuljs/nyc/issues/673 (John Haugeland)
* [[`f2890e4793`](https://github.com/StoneCypher/jssm/commit/f2890e4793)] - modifications to atoms in preparation for sigils - fixes #320 fixes #321 fixes #322 fixes #323 fixes #324 (John Haugeland)
* [[`e85442bcf2`](https://github.com/StoneCypher/jssm/commit/e85442bcf2)] - removing essentially unused rules from PEG in preparation for redoing them, fixes #314 fixes #315 fixes #316 fixes #317 fixes #318 (John Haugeland)
* [[`15bfb56849`](https://github.com/StoneCypher/jssm/commit/15bfb56849)] - eight machine attributes now fully passed through and exposed - author(s), contributor(s), comment, definition, version, license, name, reference, and fsl version (John Haugeland)
Expand Down
4 changes: 2 additions & 2 deletions build/jssm-dot.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/jssm.es5.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/jssm.es5.cjs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/jssm.es5.js

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

37 changes: 0 additions & 37 deletions build/tests/language support/english.js

This file was deleted.

23 changes: 23 additions & 0 deletions build/tests/language.js

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

4 changes: 2 additions & 2 deletions dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/lib/index.html
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset='utf-8' />
<title>jssm 5.8.0 | Documentation</title>
<title>jssm 5.8.2 | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
<link href='assets/style.css' type='text/css' rel='stylesheet' />
Expand All @@ -14,7 +14,7 @@
<div class='fixed xs-hide fix-3 overflow-auto max-height-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>jssm</h3>
<div class='mb1'><code>5.8.0</code></div>
<div class='mb1'><code>5.8.2</code></div>
<input
placeholder='Filter'
id='filter-input'
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,13 +1,13 @@
{
"name": "jssm",
"version": "5.8.0",
"version": "5.8.2",
"engines": {
"node": ">=6.0.0"
},
"description": "A Javascript finite state machine (FSM) with a terse DSL and a simple API. Well tested, and typed with Flowtype. MIT License.",
"main": "build/jssm.es5.js",
"scripts": {
"test": "nyc ava src/js/tests/**/*.js",
"test": "nyc ava src/js/tests/*.js",
"removedir": "rimraf build -f && rimraf dist -f && rimraf docs -f",
"createdir": "mkdir build && mkdir dist && mkdir docs && cd docs && mkdir docs && cd ..",
"clean": "npm run removedir && rm -f src/js/jssm-dot.js && npm run createdir",
Expand Down
27 changes: 26 additions & 1 deletion src/js/jssm-dot.peg
Expand Up @@ -159,8 +159,33 @@ WS "whitespace"
String "string"
= QuoteMark chars:Char* QuoteMark { return chars.join(""); }

AtomFirstLetter
= [0-9a-zA-Z\.\+\_\!\$\^\*\!\?\,\x80-\uFFFF]

AtomLetter
= [0-9a-zA-Z\.\+\=\_\^\(\)\*\&\$\#\@\!\?\,\x80-\uFFFF]

/*

ControlCharacters
= [\x00-\x1F\x7F]

NotAtom
= [ -=~<>:{}%\\\[\]]

LeadingSigils
= [@~#&(]

AtomFirstLetter
= !(ControlCharacters / Sigils / NotAtom) ch:. { return ch; }

AtomLetter
= !(ControlCharacters / NotAtom) ch:. { return ch; }

*/

Atom "atom"
= firstletter:[0-9a-zA-Z\.\+\_\(\)\$\!\?\,] text:[0-9a-zA-Z\.\+\_\(\)\&\$\#\@\!\?\,]* {
= firstletter:AtomFirstLetter text:AtomLetter* {
return firstletter + ((text || []).join(''));
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/tests/util/histo.js → src/js/tests/histo.js
@@ -1,7 +1,7 @@

import {describe} from 'ava-spec';

const jssm = require('../../../../build/jssm.es5.js');
const jssm = require('../../../build/jssm.es5.js');



Expand Down
25 changes: 25 additions & 0 deletions src/js/tests/language.js
@@ -0,0 +1,25 @@

/* eslint-disable max-len */

import {describe} from 'ava-spec';

const jssm = require('../../../build/jssm.es5.js'),
sm = jssm.sm,

testData = require('./language_data/english.json'),
testTokens = testData.cases;




describe('english/1', async _it => {

const foreignTarget = sm([`${testTokens.join(' -> ')};`]);

describe('contains all states', async it => {
testTokens.map(tok =>
it(tok, t => t.is(true, foreignTarget.states().includes(tok)))
);
});

});
17 changes: 17 additions & 0 deletions src/js/tests/language_data/english.json
@@ -0,0 +1,17 @@
{

"native_name" : "English",
"english_name" : "English",

"cases" : [
"ends_with_number_10",
"middle_10_number",
"10_starts_with_number",

"all_letters_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
"all_digits_0123456789",
"accents_éÉëïöËÏÖæÆœŒß",
"common_symbols_!@#$^&*()?.,=+#"
]

}

0 comments on commit 51f5944

Please sign in to comment.