occam-lexers 19.0.32 → 19.0.33
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/README.md +19 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
- [Introduction](#introduction)
|
|
8
8
|
- [Installation](#installation)
|
|
9
|
-
- [Usage](#usage)
|
|
10
9
|
- [Examples](#examples)
|
|
10
|
+
- [Usage](#usage)
|
|
11
11
|
- [Building](#building)
|
|
12
12
|
- [Contact](#contact)
|
|
13
13
|
|
|
@@ -63,6 +63,24 @@ You can also clone the repository with [Git](https://git-scm.com/)...
|
|
|
63
63
|
|
|
64
64
|
You can also run a development server, see the section on building later on.
|
|
65
65
|
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
There is a small development server that can be run from within the project's directory with the following command:
|
|
69
|
+
|
|
70
|
+
npm start
|
|
71
|
+
|
|
72
|
+
The examples will then be available at the following URL:
|
|
73
|
+
|
|
74
|
+
http://localhost:8888
|
|
75
|
+
|
|
76
|
+
The source for the examples can be found in the `src/example.js` file and corresponding `src/example` folder. You are encouraged to try the examples whilst reading what follows. You can rebuild them on the fly with the following command:
|
|
77
|
+
|
|
78
|
+
npm run watch-debug
|
|
79
|
+
|
|
80
|
+
The development server will reload the page whenever you make changes.
|
|
81
|
+
|
|
82
|
+
One last thing to bear in mind is that this package is included by way of a relative rather than a package import. If you are importing it into your own application, however, you should use the standard package import.
|
|
83
|
+
|
|
66
84
|
## Usage
|
|
67
85
|
|
|
68
86
|
Import the required lexer's class and then call it's `fromNothing()` factory method.
|
|
@@ -83,12 +101,6 @@ const content = `
|
|
|
83
101
|
```
|
|
84
102
|
The tokens are created with the `tokenise(...)` method.
|
|
85
103
|
|
|
86
|
-
## Examples
|
|
87
|
-
|
|
88
|
-
These are not very edifying, you are encouraged to have a look at Occam's [parsers](https://github.com/djalbat/occam-parsers) examples instead. However if you must, see the `index.html` file in the root of the repository and read on.
|
|
89
|
-
|
|
90
|
-
Each of the examples has a textarea in which the corresponding lexer's entries are given in JSON format. The regular expression patterns themselves are supplied as strings with the usual escaping. You can change both the lexical entries and the content to be matched dynamically, and see the resulting tokens.
|
|
91
|
-
|
|
92
104
|
## Building
|
|
93
105
|
|
|
94
106
|
Automation is done with [npm scripts](https://docs.npmjs.com/misc/scripts), have a look at the `package.json` file. The pertinent commands are:
|
|
@@ -96,12 +108,6 @@ Automation is done with [npm scripts](https://docs.npmjs.com/misc/scripts), have
|
|
|
96
108
|
npm run build-debug
|
|
97
109
|
npm run watch-debug
|
|
98
110
|
|
|
99
|
-
You can also start a small development server:
|
|
100
|
-
|
|
101
|
-
npm start
|
|
102
|
-
|
|
103
|
-
The example will then be available at http://localhost:8888 and will reload automatically when changes are made.
|
|
104
|
-
|
|
105
111
|
## Contact
|
|
106
112
|
|
|
107
113
|
* james.smith@djalbat.com
|