@danielx/civet 0.2.9 → 0.2.10

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/dist/main.js CHANGED
@@ -537,6 +537,8 @@ var require_parser = __commonJS({
537
537
  ModuleSpecifier,
538
538
  ImportedBinding,
539
539
  ExportDeclaration,
540
+ As,
541
+ Export,
540
542
  ExportFromClause,
541
543
  NamedExports,
542
544
  ExportSpecifier,
@@ -1984,8 +1986,8 @@ var require_parser = __commonJS({
1984
1986
  return IterationStatement$0(state) || IterationStatement$1(state) || IterationStatement$2(state) || IterationStatement$3(state) || IterationStatement$4(state);
1985
1987
  }
1986
1988
  }
1987
- var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), Block), function($skip, $loc, $0, $1, $2) {
1988
- var b = $2;
1989
+ var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), NonIdContinue, Block), function($skip, $loc, $0, $1, $2, $3) {
1990
+ var b = $3;
1989
1991
  return ["while(true)", b];
1990
1992
  });
1991
1993
  function LoopStatement(state) {
@@ -1997,7 +1999,7 @@ var require_parser = __commonJS({
1997
1999
  return LoopStatement$0(state);
1998
2000
  }
1999
2001
  }
2000
- var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
2002
+ var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), NonIdContinue, Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
2001
2003
  function DoWhileStatement(state) {
2002
2004
  if (state.verbose)
2003
2005
  console.log("ENTER:", "DoWhileStatement");
@@ -2007,7 +2009,7 @@ var require_parser = __commonJS({
2007
2009
  return DoWhileStatement$0(state);
2008
2010
  }
2009
2011
  }
2010
- var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), Condition, Block);
2012
+ var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), NonIdContinue, Condition, Block);
2011
2013
  function WhileStatement(state) {
2012
2014
  if (state.verbose)
2013
2015
  console.log("ENTER:", "WhileStatement");
@@ -2017,7 +2019,7 @@ var require_parser = __commonJS({
2017
2019
  return WhileStatement$0(state);
2018
2020
  }
2019
2021
  }
2020
- var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L2, fail, 'ForStatement ")"'), Block);
2022
+ var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), NonIdContinue, __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L2, fail, 'ForStatement ")"'), Block);
2021
2023
  function ForStatement(state) {
2022
2024
  if (state.verbose)
2023
2025
  console.log("ENTER:", "ForStatement");
@@ -2027,10 +2029,10 @@ var require_parser = __commonJS({
2027
2029
  return ForStatement$0(state);
2028
2030
  }
2029
2031
  }
2030
- var ForInOfStatement$0 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
2031
- var ForInOfStatement$1 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, InsertCloseParen, Block);
2032
- var ForInOfStatement$2 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
2033
- var ForInOfStatement$3 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, InsertCloseParen, Block);
2032
+ var ForInOfStatement$0 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
2033
+ var ForInOfStatement$1 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, InsertCloseParen, Block);
2034
+ var ForInOfStatement$2 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
2035
+ var ForInOfStatement$3 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, InsertCloseParen, Block);
2034
2036
  function ForInOfStatement(state) {
2035
2037
  if (state.tokenize) {
2036
2038
  return $TOKEN("ForInOfStatement", state, ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state));
@@ -2038,7 +2040,7 @@ var require_parser = __commonJS({
2038
2040
  return ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state);
2039
2041
  }
2040
2042
  }
2041
- var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), __, ForBinding);
2043
+ var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), NonIdContinue, __, ForBinding);
2042
2044
  function ForDeclaration(state) {
2043
2045
  if (state.verbose)
2044
2046
  console.log("ENTER:", "ForDeclaration");
@@ -2057,7 +2059,7 @@ var require_parser = __commonJS({
2057
2059
  return ForBinding$0(state) || ForBinding$1(state);
2058
2060
  }
2059
2061
  }
2060
- var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), Condition, CaseBlock);
2062
+ var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), NonIdContinue, Condition, CaseBlock);
2061
2063
  function SwitchStatement(state) {
2062
2064
  if (state.verbose)
2063
2065
  console.log("ENTER:", "SwitchStatement");
@@ -2101,9 +2103,9 @@ var require_parser = __commonJS({
2101
2103
  return NestedCaseClause$0(state);
2102
2104
  }
2103
2105
  }
2104
- var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
2106
+ var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), NonIdContinue, $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
2105
2107
  var CaseClause$1 = $S(When, $Q(_), Expression, ImpliedColon, NestedBlockExpressions, InsertBreak);
2106
- var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), ImpliedColon, NestedBlockExpressions);
2108
+ var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), NonIdContinue, ImpliedColon, NestedBlockExpressions);
2107
2109
  function CaseClause(state) {
2108
2110
  if (state.tokenize) {
2109
2111
  return $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state));
@@ -2111,7 +2113,7 @@ var require_parser = __commonJS({
2111
2113
  return CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state);
2112
2114
  }
2113
2115
  }
2114
- var When$0 = $T($EXPECT($L101, fail, 'When "when"'), function(value) {
2116
+ var When$0 = $T($S($EXPECT($L101, fail, 'When "when"'), NonIdContinue), function(value) {
2115
2117
  return "case";
2116
2118
  });
2117
2119
  function When(state) {
@@ -2208,12 +2210,12 @@ var require_parser = __commonJS({
2208
2210
  return ExpressionStatement$0(state);
2209
2211
  }
2210
2212
  }
2211
- var KeywordStatement$0 = $EXPECT($L105, fail, 'KeywordStatement "break"');
2212
- var KeywordStatement$1 = $EXPECT($L106, fail, 'KeywordStatement "continue"');
2213
- var KeywordStatement$2 = $EXPECT($L107, fail, 'KeywordStatement "debugger"');
2214
- var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), Expression);
2215
- var KeywordStatement$4 = $EXPECT($L108, fail, 'KeywordStatement "return"');
2216
- var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), Expression);
2213
+ var KeywordStatement$0 = $S($EXPECT($L105, fail, 'KeywordStatement "break"'), NonIdContinue);
2214
+ var KeywordStatement$1 = $S($EXPECT($L106, fail, 'KeywordStatement "continue"'), NonIdContinue);
2215
+ var KeywordStatement$2 = $S($EXPECT($L107, fail, 'KeywordStatement "debugger"'), NonIdContinue);
2216
+ var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue, Expression);
2217
+ var KeywordStatement$4 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue);
2218
+ var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), NonIdContinue, Expression);
2217
2219
  function KeywordStatement(state) {
2218
2220
  if (state.tokenize) {
2219
2221
  return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state));
@@ -2221,11 +2223,11 @@ var require_parser = __commonJS({
2221
2223
  return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state);
2222
2224
  }
2223
2225
  }
2224
- var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), __, ImportClause, __, FromClause), function(value) {
2226
+ var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), NonIdContinue, __, ImportClause, __, FromClause), function(value) {
2225
2227
  return { "ts": true, "children": value };
2226
2228
  });
2227
- var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ImportClause, __, FromClause);
2228
- var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ModuleSpecifier);
2229
+ var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ImportClause, __, FromClause);
2230
+ var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ModuleSpecifier);
2229
2231
  function ImportDeclaration(state) {
2230
2232
  if (state.tokenize) {
2231
2233
  return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
@@ -2243,7 +2245,7 @@ var require_parser = __commonJS({
2243
2245
  return ImportClause$0(state) || ImportClause$1(state) || ImportClause$2(state);
2244
2246
  }
2245
2247
  }
2246
- var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), __, ImportedBinding);
2248
+ var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), NonIdContinue, __, ImportedBinding);
2247
2249
  function NameSpaceImport(state) {
2248
2250
  if (state.verbose)
2249
2251
  console.log("ENTER:", "NameSpaceImport");
@@ -2263,7 +2265,7 @@ var require_parser = __commonJS({
2263
2265
  return NamedImports$0(state);
2264
2266
  }
2265
2267
  }
2266
- var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), __, ModuleSpecifier);
2268
+ var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), NonIdContinue, __, ModuleSpecifier);
2267
2269
  function FromClause(state) {
2268
2270
  if (state.verbose)
2269
2271
  console.log("ENTER:", "FromClause");
@@ -2273,7 +2275,7 @@ var require_parser = __commonJS({
2273
2275
  return FromClause$0(state);
2274
2276
  }
2275
2277
  }
2276
- var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), __, ImportedBinding, ObjectPropertyDelimiter);
2278
+ var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), NonIdContinue, __, ImportedBinding, ObjectPropertyDelimiter);
2277
2279
  var ImportSpecifier$1 = $S(__, ImportedBinding, ObjectPropertyDelimiter);
2278
2280
  function ImportSpecifier(state) {
2279
2281
  if (state.tokenize) {
@@ -2311,9 +2313,9 @@ var require_parser = __commonJS({
2311
2313
  return ImportedBinding$0(state);
2312
2314
  }
2313
2315
  }
2314
- var ExportDeclaration$0 = $S($EXPECT($L112, fail, 'ExportDeclaration "export"'), __, $EXPECT($L100, fail, 'ExportDeclaration "default"'), __, $C(HoistableDeclaration, ClassDeclaration, AssignmentExpression));
2315
- var ExportDeclaration$1 = $S($EXPECT($L112, fail, 'ExportDeclaration "export"'), __, ExportFromClause, __, FromClause);
2316
- var ExportDeclaration$2 = $S($EXPECT($L112, fail, 'ExportDeclaration "export"'), __, $C(NamedExports, VariableStatement, Declaration));
2316
+ var ExportDeclaration$0 = $S(Export, __, $EXPECT($L100, fail, 'ExportDeclaration "default"'), NonIdContinue, __, $C(HoistableDeclaration, ClassDeclaration, AssignmentExpression));
2317
+ var ExportDeclaration$1 = $S(Export, __, ExportFromClause, __, FromClause);
2318
+ var ExportDeclaration$2 = $S(Export, __, $C(NamedExports, VariableStatement, Declaration));
2317
2319
  function ExportDeclaration(state) {
2318
2320
  if (state.tokenize) {
2319
2321
  return $TOKEN("ExportDeclaration", state, ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state));
@@ -2321,7 +2323,27 @@ var require_parser = __commonJS({
2321
2323
  return ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state);
2322
2324
  }
2323
2325
  }
2324
- var ExportFromClause$0 = $S($EXPECT($L9, fail, 'ExportFromClause "*"'), $E($S(__, $EXPECT($L4, fail, 'ExportFromClause "as"'), __, ModuleExportName)));
2326
+ var As$0 = $S($EXPECT($L4, fail, 'As "as"'), NonIdContinue);
2327
+ function As(state) {
2328
+ if (state.verbose)
2329
+ console.log("ENTER:", "As");
2330
+ if (state.tokenize) {
2331
+ return $TOKEN("As", state, As$0(state));
2332
+ } else {
2333
+ return As$0(state);
2334
+ }
2335
+ }
2336
+ var Export$0 = $S($EXPECT($L112, fail, 'Export "export"'), NonIdContinue);
2337
+ function Export(state) {
2338
+ if (state.verbose)
2339
+ console.log("ENTER:", "Export");
2340
+ if (state.tokenize) {
2341
+ return $TOKEN("Export", state, Export$0(state));
2342
+ } else {
2343
+ return Export$0(state);
2344
+ }
2345
+ }
2346
+ var ExportFromClause$0 = $S($EXPECT($L9, fail, 'ExportFromClause "*"'), $E($S(__, $EXPECT($L4, fail, 'ExportFromClause "as"'), NonIdContinue, __, ModuleExportName)));
2325
2347
  var ExportFromClause$1 = NamedExports;
2326
2348
  function ExportFromClause(state) {
2327
2349
  if (state.tokenize) {
@@ -0,0 +1,16 @@
1
+ declare module "@danielx/civet" {
2
+ export type CivetAST = unknown;
3
+ export type CompileOptions = {
4
+ js?: boolean
5
+ }
6
+
7
+ export function compile(source: string, options?: CompileOptions): string
8
+ export function parse(source: string): CivetAST
9
+ export function generate(ast: CivetAST, options?: CompileOptions): string
10
+
11
+ export default interface Civet {
12
+ compile: typeof compile;
13
+ parse: typeof parse;
14
+ generate: typeof generate;
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
+ "types": "dist/types.d.ts",
6
7
  "bin": {
7
8
  "civet": "dist/civet"
8
9
  },