ohm-js 16.3.2 → 16.4.0

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.
Files changed (52) hide show
  1. package/dist/dist/built-in-rules.d.ts +2 -0
  2. package/dist/dist/ohm-grammar.d.ts +2 -0
  3. package/dist/dist/operations-and-attributes.d.ts +2 -0
  4. package/dist/ohm.esm.js +21 -20
  5. package/dist/ohm.js +7 -7
  6. package/dist/ohm.min.js +1 -1
  7. package/dist/src/Builder.d.ts +25 -0
  8. package/dist/src/CaseInsensitiveTerminal.d.ts +15 -0
  9. package/dist/src/Failure.d.ts +22 -0
  10. package/dist/src/Grammar.d.ts +66 -0
  11. package/dist/src/GrammarDecl.d.ts +23 -0
  12. package/dist/src/InputStream.d.ts +16 -0
  13. package/dist/src/Interval.d.ts +29 -0
  14. package/dist/src/MatchResult.d.ts +20 -0
  15. package/dist/src/MatchState.d.ts +57 -0
  16. package/dist/src/Matcher.d.ts +15 -0
  17. package/dist/src/Namespace.d.ts +8 -0
  18. package/dist/src/PosInfo.d.ts +17 -0
  19. package/dist/src/Semantics.d.ts +49 -0
  20. package/dist/src/Trace.d.ts +23 -0
  21. package/dist/src/deferredInit.d.ts +1 -0
  22. package/dist/src/errors.d.ts +25 -0
  23. package/dist/src/grammarDeferredInit.d.ts +1 -0
  24. package/dist/src/main.d.ts +13 -0
  25. package/dist/src/makeRecipe.d.ts +1 -0
  26. package/dist/src/nodes.d.ts +40 -0
  27. package/dist/src/ohm-cmd.d.ts +2 -0
  28. package/dist/src/pexprs-allowsSkippingPrecedingSpace.d.ts +1 -0
  29. package/dist/src/pexprs-assertAllApplicationsAreValid.d.ts +1 -0
  30. package/dist/src/pexprs-assertChoicesHaveUniformArity.d.ts +1 -0
  31. package/dist/src/pexprs-assertIteratedExprsAreNotNullable.d.ts +1 -0
  32. package/dist/src/pexprs-eval.d.ts +1 -0
  33. package/dist/src/pexprs-getArity.d.ts +1 -0
  34. package/dist/src/pexprs-introduceParams.d.ts +1 -0
  35. package/dist/src/pexprs-isNullable.d.ts +1 -0
  36. package/dist/src/pexprs-main.d.ts +83 -0
  37. package/dist/src/pexprs-outputRecipe.d.ts +1 -0
  38. package/dist/src/pexprs-substituteParams.d.ts +1 -0
  39. package/dist/src/pexprs-toArgumentNameList.d.ts +1 -0
  40. package/dist/src/pexprs-toDisplayString.d.ts +1 -0
  41. package/dist/src/pexprs-toFailure.d.ts +1 -0
  42. package/dist/src/pexprs-toString.d.ts +1 -0
  43. package/dist/src/pexprs.d.ts +2 -0
  44. package/dist/src/semanticsDeferredInit.d.ts +1 -0
  45. package/dist/src/util.d.ts +15 -0
  46. package/dist/src/version.d.ts +2 -0
  47. package/dist/third_party/UnicodeCategories.d.ts +13 -0
  48. package/index.d.ts +57 -4
  49. package/package.json +16 -15
  50. package/src/Grammar.js +1 -1
  51. package/src/errors.js +2 -2
  52. package/src/main.js +2 -2
@@ -0,0 +1,13 @@
1
+ export const Lu: RegExp;
2
+ export const Ll: RegExp;
3
+ export const Lt: RegExp;
4
+ export const Lm: RegExp;
5
+ export const Lo: RegExp;
6
+ export const Nl: RegExp;
7
+ export const Nd: RegExp;
8
+ export const Mn: RegExp;
9
+ export const Mc: RegExp;
10
+ export const Pc: RegExp;
11
+ export const Zs: RegExp;
12
+ export const L: RegExp;
13
+ export const Ltmo: RegExp;
package/index.d.ts CHANGED
@@ -5,6 +5,33 @@ export = ohm;
5
5
  declare namespace ohm {
6
6
  const ohmGrammar: Grammar;
7
7
 
8
+ /**
9
+ * Constructors for parsing expressions (aka pexprs). (Except for `any`
10
+ * and `end`, which are not constructors but singleton instances.)
11
+ */
12
+ const pexprs: {
13
+ PExpr: typeof PExpr;
14
+ Terminal: typeof Terminal;
15
+ Range: typeof Range;
16
+ Param: typeof Param;
17
+ Alt: typeof Alt;
18
+ Extend: typeof Extend;
19
+ Splice: typeof Splice;
20
+ Seq: typeof Seq;
21
+ Iter: typeof Iter;
22
+ Star: typeof Star;
23
+ Plus: typeof Plus;
24
+ Opt: typeof Opt;
25
+ Not: typeof Not;
26
+ Lookahead: typeof Lookahead;
27
+ Lex: typeof Lex;
28
+ Apply: typeof Apply;
29
+ UnicodeChar: typeof UnicodeChar;
30
+ CaseInsensitiveTerminal: typeof CaseInsensitiveTerminal;
31
+ any: PExpr;
32
+ end: PExpr;
33
+ };
34
+
8
35
  /**
9
36
  * Instantiate the Grammar defined by source. If specified, namespace is
10
37
  * the Namespace to use when resolving external references in the grammar.
@@ -13,7 +40,7 @@ declare namespace ohm {
13
40
 
14
41
  /**
15
42
  * grammarFromScriptElement was removed in Ohm v16.0. See
16
- * https://git.io/Jwow5 for more info.
43
+ * https://ohmjs.org/d/gfs for more info.
17
44
  * @deprecated
18
45
  */
19
46
  function grammarFromScriptElement(node?: unknown, namespace?: Namespace): Grammar;
@@ -28,7 +55,7 @@ declare namespace ohm {
28
55
 
29
56
  /**
30
57
  * grammarsFromScriptElements was removed in Ohm v16.0. See
31
- * https://git.io/Jwow5 for more info.
58
+ * https://ohmjs.org/d/gfs for more info.
32
59
  * @deprecated
33
60
  */
34
61
  function grammarsFromScriptElements(nodeList?: unknown, namespace?: Namespace): Namespace;
@@ -98,7 +125,33 @@ declare namespace ohm {
98
125
  extendSemantics(superSemantics: Semantics): Semantics;
99
126
  }
100
127
 
101
- interface PExpr {}
128
+ class PExpr {
129
+ getArity(): number;
130
+ isNullable(): boolean;
131
+ toString(): string;
132
+ toDisplayString(): string;
133
+ }
134
+ class Terminal extends PExpr {}
135
+ class Range extends PExpr {}
136
+ class Param extends PExpr {}
137
+ class Alt extends PExpr {
138
+ terms: PExpr[];
139
+ }
140
+ class Extend extends Alt {}
141
+ class Splice extends Alt {}
142
+ class Seq extends PExpr {
143
+ factors: PExpr[];
144
+ }
145
+ class Iter extends PExpr {}
146
+ class Star extends Iter {}
147
+ class Plus extends Iter {}
148
+ class Opt extends Iter {}
149
+ class Not extends PExpr {}
150
+ class Lookahead extends PExpr {}
151
+ class Lex extends PExpr {}
152
+ class Apply extends PExpr {}
153
+ class UnicodeChar extends PExpr {}
154
+ class CaseInsensitiveTerminal extends PExpr {}
102
155
 
103
156
  /**
104
157
  * Matcher objects are used to incrementally match a changing input
@@ -307,7 +360,7 @@ declare namespace ohm {
307
360
  /**
308
361
  * True if Node is ? option
309
362
  */
310
- isOptional: boolean;
363
+ isOptional(): boolean;
311
364
 
312
365
  /**
313
366
  * In addition to the properties defined above, within a given
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohm-js",
3
- "version": "16.3.2",
3
+ "version": "16.4.0",
4
4
  "description": "An object-oriented language for parsing and pattern matching",
5
5
  "repository": "https://github.com/harc/ohm",
6
6
  "keywords": [
@@ -56,38 +56,39 @@
56
56
  "Tony Garnock-Jones <tonygarnockjones@gmail.com>",
57
57
  "Saketh Kasibatla <sake.kasi@gmail.com>",
58
58
  "Lionel Landwerlin <llandwerlin@gmail.com>",
59
- "Jason Merrill <jwmerrill@gmail.com>",
60
59
  "Ray Toal <rtoal@lmu.edu>",
60
+ "Jason Merrill <jwmerrill@gmail.com>",
61
61
  "Yoshiki Ohshima <Yoshiki.Ohshima@acm.org>",
62
62
  "megabuz <3299889+megabuz@users.noreply.github.com>",
63
- "stagas <gstagas@gmail.com>",
64
- "Jonathan Edwards <JonathanMEdwards@gmail.com>",
65
63
  "Milan Lajtoš <milan.lajtos@me.com>",
66
64
  "Neil Jewers <njjewers@uwaterloo.ca>",
67
- "Mike Niebling <(none)>",
68
- "AngryPowman <angrypowman@qq.com>",
69
- "Patrick Dubroy <patrick@sourcegraph.com>",
70
- "Leslie Ying <acetophore@users.noreply.github.com>",
65
+ "Jonathan Edwards <JonathanMEdwards@gmail.com>",
66
+ "stagas <gstagas@gmail.com>",
67
+ "Daniel Tomlinson <DanielTomlinson@me.com>",
71
68
  "Pierre Donias <pierre.donias@gmail.com>",
72
- "Justin Chase <justin.m.chase@gmail.com>",
73
- "Ian Harris <ian@fofgof.xyz>",
69
+ "Casey Olson <casey.m.olson@gmail.com>",
70
+ "Arthur Carabott <arthurc@gmail.com>",
74
71
  "Stan Rozenraukh <stan@stanistan.com>",
75
72
  "Stephan Seidt <stephan.seidt@gmail.com>",
76
- "Steve Phillips <steve@tryingtobeawesome.com>",
73
+ "Leslie Ying <acetophore@users.noreply.github.com>",
77
74
  "Szymon Kaliski <kaliskiszymon@gmail.com>",
78
75
  "Thomas Nyberg <tomnyberg@gmail.com>",
79
- "Daniel Tomlinson <DanielTomlinson@me.com>",
76
+ "AngryPowman <angrypowman@qq.com>",
80
77
  "Vse Mozhet Byt <vsemozhetbyt@gmail.com>",
81
78
  "Wil Chung <10446+iamwilhelm@users.noreply.github.com>",
82
- "Casey Olson <casey.m.olson@gmail.com>",
79
+ "Zachary Sakowitz <zsakowitz@gmail.com>",
83
80
  "abego <ub@abego-software.de>",
84
81
  "acslk <d_vd415@hotmail.com>",
85
82
  "codeZeilen <codeZeilen@users.noreply.github.com>",
86
83
  "kassadin <kassadin@foxmail.com>",
87
- "Arthur Carabott <arthurc@gmail.com>",
88
84
  "owch <bowenrainyday@gmail.com>",
85
+ "sfinnie <scott.finnie@gmail.com>",
86
+ "Steve Phillips <steve@tryingtobeawesome.com>",
87
+ "Justin Chase <justin.m.chase@gmail.com>",
89
88
  "Luca Guzzon <luca.guzzon@gmail.com>",
90
- "sfinnie <scott.finnie@gmail.com>"
89
+ "Ian Harris <ian@fofgof.xyz>",
90
+ "Mike Niebling <(none)>",
91
+ "Patrick Dubroy <patrick@sourcegraph.com>"
91
92
  ],
92
93
  "dependencies": {},
93
94
  "devDependencies": {
package/src/Grammar.js CHANGED
@@ -140,7 +140,7 @@ Grammar.prototype = {
140
140
  if (k === '_iter' || k === '_nonterminal') {
141
141
  details =
142
142
  `it should use a rest parameter, e.g. \`${k}(...children) {}\`. ` +
143
- 'NOTE: this is new in Ohm v16 — see https://git.io/Jz4CI for details.';
143
+ 'NOTE: this is new in Ohm v16 — see https://ohmjs.org/d/ati for details.';
144
144
  } else {
145
145
  details = `expected ${expected}, got ${actual}`;
146
146
  }
package/src/errors.js CHANGED
@@ -168,7 +168,7 @@ function invalidParameter(ruleName, expr) {
168
168
 
169
169
  const syntacticVsLexicalNote =
170
170
  'NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. ' +
171
- 'See https://git.io/JiYgP for more details.';
171
+ 'See https://ohmjs.org/d/svl for more details.';
172
172
 
173
173
  function applicationOfSyntacticRuleFromLexicalContext(ruleName, applyExpr) {
174
174
  return createError(
@@ -298,7 +298,7 @@ function missingSemanticAction(ctorName, name, type, stack) {
298
298
  if (ctorName === '_iter') {
299
299
  moreInfo = [
300
300
  '\nNOTE: as of Ohm v16, there is no default action for iteration nodes — see ',
301
- ' https://git.io/JRwtG for details.',
301
+ ' https://ohmjs.org/d/dsa for details.',
302
302
  ].join('\n');
303
303
  }
304
304
 
package/src/main.js CHANGED
@@ -295,13 +295,13 @@ function grammars(source, optNamespace) {
295
295
 
296
296
  function grammarFromScriptElement(optNode) {
297
297
  throw new Error(
298
- 'grammarFromScriptElement was removed in Ohm v16.0. See https://git.io/Jwow5 for more info.'
298
+ 'grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'
299
299
  );
300
300
  }
301
301
 
302
302
  function grammarsFromScriptElements(optNodeOrNodeList) {
303
303
  throw new Error(
304
- 'grammarsFromScriptElements was removed in Ohm v16.0. See https://git.io/Jwow5 for more info.'
304
+ 'grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'
305
305
  );
306
306
  }
307
307