@halleyassist/rule-templater 0.0.6 → 0.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halleyassist/rule-templater",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "The grammar for HalleyAssist rules",
5
5
  "main": "src/RuleTemplater.production.js",
6
6
  "browser": "./dist/rule-templater.browser.js",
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "homepage": "https://github.com/HalleyAssist/rule-templater#readme",
22
22
  "dependencies": {
23
- "@halleyassist/rule-parser": "^1.0.19",
23
+ "@halleyassist/rule-parser": "^1.0.22",
24
24
  "ebnf": "git+https://github.com/HalleyAssist/node-ebnf.git"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/node": "^25.1.0",
27
+ "@types/node": "^25.3.1",
28
28
  "browserify": "^17.0.1",
29
29
  "chai": "^4",
30
30
  "gulp": "^5.0.1",
@@ -24,7 +24,7 @@ const grammar = `
24
24
  template_filter_arg ::= value | template_value
25
25
 
26
26
  number_atom ::= number | template_value
27
- number_time_atom ::= number_time | template_value
27
+ number_time_atom ::= number_time | template_value WS+ unit | template_value
28
28
  tod_atom ::= number_tod | template_value
29
29
  dow_atom ::= dow | template_value
30
30
  between_time_only_atom ::= between_time_only | template_value
@@ -1 +1 @@
1
- module.exports=[{"name":"TEMPLATE_BEGIN","bnf":[["\"${\""]]},{"name":"TEMPLATE_END","bnf":[["\"}\""]]},{"name":"PIPE","bnf":[["\"|\""]]},{"name":"%IDENT[2]","bnf":[[/[A-Za-z0-9_]/]]},{"name":"IDENT","bnf":[[/[A-Za-z_]/,"%IDENT[2]*"]]},{"name":"DOT","bnf":[["\".\""]]},{"name":"template_value","bnf":[["TEMPLATE_BEGIN","WS*","template_expr","WS*","TEMPLATE_END"]]},{"name":"%template_expr[2]","bnf":[["WS*","template_pipe","WS*","template_filter_call"]],"fragment":true},{"name":"template_expr","bnf":[["template_path","%template_expr[2]*"]]},{"name":"template_pipe","bnf":[["PIPE"]]},{"name":"%template_path[2]","bnf":[["WS*","DOT","WS*","IDENT"]],"fragment":true},{"name":"template_path","bnf":[["IDENT","%template_path[2]*"]]},{"name":"%template_filter_call[2]","bnf":[["WS*","BEGIN_ARGUMENT","WS*","template_filter_args?","WS*","END_ARGUMENT"]],"fragment":true},{"name":"template_filter_call","bnf":[["template_filter_name","%template_filter_call[2]?"]]},{"name":"template_filter_name","bnf":[["IDENT"]]},{"name":"%template_filter_args[2]","bnf":[["WS*","\",\"","WS*","template_filter_arg"]],"fragment":true},{"name":"template_filter_args","bnf":[["template_filter_arg","%template_filter_args[2]*"]]},{"name":"template_filter_arg","bnf":[["value"],["template_value"]]},{"name":"number_atom","bnf":[["number"],["template_value"]]},{"name":"number_time_atom","bnf":[["number_time"],["template_value"]]},{"name":"tod_atom","bnf":[["number_tod"],["template_value"]]},{"name":"dow_atom","bnf":[["dow"],["template_value"]]},{"name":"between_time_only_atom","bnf":[["between_time_only"],["template_value"]]},{"name":"between_tod_only_atom","bnf":[["between_tod_only"],["template_value"]]}]
1
+ module.exports=[{"name":"TEMPLATE_BEGIN","bnf":[["\"${\""]]},{"name":"TEMPLATE_END","bnf":[["\"}\""]]},{"name":"PIPE","bnf":[["\"|\""]]},{"name":"%IDENT[2]","bnf":[[/[A-Za-z0-9_]/]]},{"name":"IDENT","bnf":[[/[A-Za-z_]/,"%IDENT[2]*"]]},{"name":"DOT","bnf":[["\".\""]]},{"name":"template_value","bnf":[["TEMPLATE_BEGIN","WS*","template_expr","WS*","TEMPLATE_END"]]},{"name":"%template_expr[2]","bnf":[["WS*","template_pipe","WS*","template_filter_call"]],"fragment":true},{"name":"template_expr","bnf":[["template_path","%template_expr[2]*"]]},{"name":"template_pipe","bnf":[["PIPE"]]},{"name":"%template_path[2]","bnf":[["WS*","DOT","WS*","IDENT"]],"fragment":true},{"name":"template_path","bnf":[["IDENT","%template_path[2]*"]]},{"name":"%template_filter_call[2]","bnf":[["WS*","BEGIN_ARGUMENT","WS*","template_filter_args?","WS*","END_ARGUMENT"]],"fragment":true},{"name":"template_filter_call","bnf":[["template_filter_name","%template_filter_call[2]?"]]},{"name":"template_filter_name","bnf":[["IDENT"]]},{"name":"%template_filter_args[2]","bnf":[["WS*","\",\"","WS*","template_filter_arg"]],"fragment":true},{"name":"template_filter_args","bnf":[["template_filter_arg","%template_filter_args[2]*"]]},{"name":"template_filter_arg","bnf":[["value"],["template_value"]]},{"name":"number_atom","bnf":[["number"],["template_value"]]},{"name":"number_time_atom","bnf":[["number_time"],["template_value","WS+","unit"],["template_value"]]},{"name":"tod_atom","bnf":[["number_tod"],["template_value"]]},{"name":"dow_atom","bnf":[["dow"],["template_value"]]},{"name":"between_time_only_atom","bnf":[["between_time_only"],["template_value"]]},{"name":"between_tod_only_atom","bnf":[["between_tod_only"],["template_value"]]}]
@@ -1,9 +1,9 @@
1
- // Note: We import the internal RuleParser.ebnf to extend the grammar with template rules.
2
- // This creates coupling to the internal structure of @halleyassist/rule-parser.
3
- const RuleParserRules = require('@halleyassist/rule-parser/src/RuleParser.ebnf'),
4
- TemplateGrammar = require('./RuleTemplate.ebnf'),
1
+ // Note: We are coupled closely with the ebnf grammar structure of rule-parser
2
+ const TemplateGrammar = require('./RuleTemplate.ebnf'),
5
3
  TemplateFilters = require('./TemplateFilters'),
6
- {Parser} = require('ebnf');
4
+ RuleParser = require('@halleyassist/rule-parser'),
5
+ RuleParserRules = RuleParser.ParserRules,
6
+ {Parser} = require('ebnf');
7
7
 
8
8
  let ParserCache = null;
9
9
 
@@ -69,7 +69,7 @@ class RuleTemplate {
69
69
  ParserCache = new Parser(ParserRules, {debug: false})
70
70
  }
71
71
 
72
- const ast = ParserCache.getAST(ruleTemplate.trim(), 'statement_main');
72
+ const ast = RuleParser.toAst(ruleTemplate.trim(), ParserCache);
73
73
  return new RuleTemplate(ruleTemplate, ast);
74
74
  }
75
75
 
@@ -1,9 +1,9 @@
1
- // Note: We import the internal RuleParser.ebnf to extend the grammar with template rules.
2
- // This creates coupling to the internal structure of @halleyassist/rule-parser.
3
- const RuleParserRules = require('@halleyassist/rule-parser/src/RuleParser.ebnf'),
4
- TemplateGrammar = require('./RuleTemplate.production.ebnf.js'),
1
+ // Note: We are coupled closely with the ebnf grammar structure of rule-parser
2
+ const TemplateGrammar = require('./RuleTemplate.production.ebnf.js'),
5
3
  TemplateFilters = require('./TemplateFilters'),
6
- {Parser} = require('ebnf');
4
+ RuleParser = require('@halleyassist/rule-parser'),
5
+ RuleParserRules = RuleParser.ParserRules,
6
+ {Parser} = require('ebnf');
7
7
 
8
8
  let ParserCache = null;
9
9
 
@@ -69,7 +69,7 @@ class RuleTemplate {
69
69
  ParserCache = new Parser(ParserRules, {debug: false})
70
70
  }
71
71
 
72
- const ast = ParserCache.getAST(ruleTemplate.trim(), 'statement_main');
72
+ const ast = RuleParser.toAst(ruleTemplate.trim(), ParserCache);
73
73
  return new RuleTemplate(ruleTemplate, ast);
74
74
  }
75
75