astn 0.111.28 → 0.111.30

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 (81) hide show
  1. package/dist/bin/convert_to_json.js +2 -2
  2. package/dist/bin/validate_astn.js +2 -2
  3. package/dist/exceptional/authoring_parse/string_iterator.js +3 -3
  4. package/dist/exceptional/authoring_parse/token.js +3 -3
  5. package/dist/exceptional/sealed_parse/string_iterator.js +3 -3
  6. package/dist/exceptional/sealed_parse/token.js +3 -3
  7. package/dist/exceptional/serializers/parse_result.js +2 -2
  8. package/dist/implementation/algorithms/operations/impure/string/serialize_apostrophed_string.js +12 -0
  9. package/dist/implementation/algorithms/operations/impure/string/serialize_backticked_string.js +12 -0
  10. package/dist/implementation/algorithms/operations/impure/string/serialize_quoted_string.js +12 -0
  11. package/dist/implementation/{procedures → algorithms/procedures}/unguaranteed/convert_to_json.js +5 -5
  12. package/dist/implementation/{procedures → algorithms/procedures}/unguaranteed/validate_astn.js +5 -5
  13. package/dist/implementation/{transformations → algorithms/transformations}/authoring_parse_tree/authoring_target.js +1 -1
  14. package/dist/implementation/{transformations → algorithms/transformations}/authoring_parse_tree/ide.d.ts +3 -3
  15. package/dist/implementation/algorithms/transformations/authoring_parse_tree/ide.js +171 -0
  16. package/dist/implementation/{transformations → algorithms/transformations}/authoring_parse_tree/json_target.d.ts +2 -2
  17. package/dist/implementation/algorithms/transformations/authoring_parse_tree/json_target.js +90 -0
  18. package/dist/implementation/algorithms/transformations/authoring_parse_tree/temp_value_range.d.ts +3 -0
  19. package/dist/implementation/algorithms/transformations/authoring_parse_tree/temp_value_range.js +88 -0
  20. package/dist/implementation/{transformations → algorithms/transformations}/authoring_target/fountain_pen_block.d.ts +2 -2
  21. package/dist/implementation/algorithms/transformations/authoring_target/fountain_pen_block.js +179 -0
  22. package/dist/implementation/algorithms/transformations/sealed_target/fountain_pen_block.d.ts +4 -0
  23. package/dist/implementation/algorithms/transformations/sealed_target/fountain_pen_block.js +123 -0
  24. package/dist/implementation/generated/pareto/generic/parse/ast.d.ts +10 -0
  25. package/dist/implementation/generated/pareto/generic/parse/ast.js +245 -0
  26. package/dist/implementation/generated/pareto/generic/parse/astn_parse_generic.d.ts +13 -0
  27. package/dist/implementation/generated/pareto/generic/parse/astn_parse_generic.js +50 -0
  28. package/dist/implementation/generated/pareto/generic/parse/parse.d.ts +6 -0
  29. package/dist/implementation/generated/pareto/generic/parse/parse.js +65 -0
  30. package/dist/implementation/generated/pareto/generic/parse/string_iterator.d.ts +41 -0
  31. package/dist/implementation/generated/pareto/generic/parse/string_iterator.js +113 -0
  32. package/dist/implementation/generated/pareto/generic/parse/token.d.ts +9 -0
  33. package/dist/implementation/generated/pareto/generic/parse/token.js +519 -0
  34. package/dist/implementation/generated/pareto/generic/serialize.d.ts +4 -0
  35. package/dist/implementation/generated/pareto/generic/serialize.js +93 -0
  36. package/dist/implementation/generated/pareto/generic/unmarshall.d.ts +26 -26
  37. package/dist/implementation/generated/pareto/generic/unmarshall.js +19 -10
  38. package/dist/interface/algorithms/operations/impure/string/serialize_apostrophed_string.d.ts +1 -0
  39. package/dist/interface/algorithms/operations/impure/string/serialize_apostrophed_string.js +5 -0
  40. package/dist/interface/algorithms/operations/impure/string/serialize_backticked_string.d.ts +1 -0
  41. package/dist/interface/algorithms/operations/impure/string/serialize_backticked_string.js +5 -0
  42. package/dist/interface/algorithms/operations/impure/string/serialize_quoted_string.d.ts +1 -0
  43. package/dist/interface/algorithms/operations/impure/string/serialize_quoted_string.js +5 -0
  44. package/dist/interface/algorithms/procedures/unguaranteed/convert_to_json.d.ts +1 -0
  45. package/dist/interface/algorithms/procedures/unguaranteed/convert_to_json.js +5 -0
  46. package/dist/interface/algorithms/procedures/unguaranteed/validate_astn.d.ts +1 -0
  47. package/dist/interface/algorithms/procedures/unguaranteed/validate_astn.js +5 -0
  48. package/dist/interface/algorithms/transformations/authoring_parse_tree/authoring_target.d.ts +1 -0
  49. package/dist/interface/algorithms/transformations/authoring_parse_tree/authoring_target.js +5 -0
  50. package/dist/interface/algorithms/transformations/authoring_parse_tree/ide.d.ts +1 -0
  51. package/dist/interface/algorithms/transformations/authoring_parse_tree/ide.js +5 -0
  52. package/dist/interface/algorithms/transformations/authoring_parse_tree/json_target.d.ts +1 -0
  53. package/dist/interface/algorithms/transformations/authoring_parse_tree/json_target.js +5 -0
  54. package/dist/interface/algorithms/transformations/authoring_parse_tree/temp_value_range.d.ts +1 -0
  55. package/dist/interface/algorithms/transformations/authoring_parse_tree/temp_value_range.js +5 -0
  56. package/dist/interface/algorithms/transformations/authoring_target/fountain_pen_block.d.ts +1 -0
  57. package/dist/interface/algorithms/transformations/authoring_target/fountain_pen_block.js +5 -0
  58. package/dist/interface/algorithms/transformations/sealed_target/fountain_pen_block.d.ts +1 -0
  59. package/dist/interface/algorithms/transformations/sealed_target/fountain_pen_block.js +5 -0
  60. package/dist/interface/generated/pareto/core/astn_source.d.ts +15 -0
  61. package/dist/interface/generated/pareto/core/parse_result.d.ts +25 -0
  62. package/dist/interface/generated/pareto/core/parse_result.js +3 -0
  63. package/dist/interface/generated/pareto/core/token.d.ts +49 -0
  64. package/dist/interface/generated/pareto/core/token.js +3 -0
  65. package/package.json +4 -4
  66. package/dist/implementation/operations/impure/string/serialize_apostrophed_string.js +0 -12
  67. package/dist/implementation/operations/impure/string/serialize_backticked_string.js +0 -12
  68. package/dist/implementation/operations/impure/string/serialize_quoted_string.js +0 -12
  69. package/dist/implementation/transformations/authoring_parse_tree/ide.js +0 -171
  70. package/dist/implementation/transformations/authoring_parse_tree/json_target.js +0 -90
  71. package/dist/implementation/transformations/authoring_parse_tree/temp_value_range.d.ts +0 -3
  72. package/dist/implementation/transformations/authoring_parse_tree/temp_value_range.js +0 -88
  73. package/dist/implementation/transformations/authoring_target/fountain_pen_block.js +0 -179
  74. package/dist/implementation/transformations/sealed_target/fountain_pen_block.d.ts +0 -4
  75. package/dist/implementation/transformations/sealed_target/fountain_pen_block.js +0 -123
  76. /package/dist/implementation/{operations → algorithms/operations}/impure/string/serialize_apostrophed_string.d.ts +0 -0
  77. /package/dist/implementation/{operations → algorithms/operations}/impure/string/serialize_backticked_string.d.ts +0 -0
  78. /package/dist/implementation/{operations → algorithms/operations}/impure/string/serialize_quoted_string.d.ts +0 -0
  79. /package/dist/implementation/{procedures → algorithms/procedures}/unguaranteed/convert_to_json.d.ts +0 -0
  80. /package/dist/implementation/{procedures → algorithms/procedures}/unguaranteed/validate_astn.d.ts +0 -0
  81. /package/dist/implementation/{transformations → algorithms/transformations}/authoring_parse_tree/authoring_target.d.ts +0 -0
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.create_string_iterator = exports.is_control_character = void 0;
4
+ const to_character_list_1 = require("exupery-standard-library/dist/implementation/operations/impure/text/to_character_list");
5
+ const starts_with_1 = require("exupery-standard-library/dist/implementation/operations/impure/text/starts_with");
6
+ const WhitespaceChars = {
7
+ tab: 0x09, // \t
8
+ line_feed: 0x0A, // \n
9
+ carriage_return: 0x0D, // \r
10
+ space: 0x20, //
11
+ };
12
+ const is_control_character = ($) => {
13
+ return ($ < 0x20 && $ !== WhitespaceChars.tab && $ !== WhitespaceChars.line_feed && $ !== WhitespaceChars.carriage_return);
14
+ };
15
+ exports.is_control_character = is_control_character;
16
+ /**
17
+ * Creates a string iterator that allows iterating over characters in a string,
18
+ * while keeping track of line numbers, columns, and line indentation.
19
+ */
20
+ const create_string_iterator = ($, $p) => {
21
+ const source = $;
22
+ const characters = (0, to_character_list_1.$$)($);
23
+ const length = characters.__get_length();
24
+ let found_carriage_return_before = false;
25
+ let position = 0;
26
+ let relative_position = {
27
+ 'line': 0,
28
+ 'column': 0,
29
+ 'line indentation': null
30
+ };
31
+ const consume_character = () => {
32
+ const c = characters.__get_element_at(position);
33
+ const start = relative_position;
34
+ relative_position = c.transform(($) => {
35
+ return $ === WhitespaceChars.line_feed
36
+ ? {
37
+ 'line': relative_position.line + 1,
38
+ 'column': 0,
39
+ 'line indentation': null,
40
+ }
41
+ : found_carriage_return_before
42
+ ? {
43
+ 'line': relative_position.line + 1,
44
+ 'column': 0,
45
+ 'line indentation': null,
46
+ }
47
+ : {
48
+ 'line': relative_position.line,
49
+ 'column': relative_position['column'] + ($ === WhitespaceChars.tab
50
+ ? $p['tab size']
51
+ : 1),
52
+ 'line indentation': relative_position['line indentation'] !== null
53
+ ? relative_position['line indentation']
54
+ : $ === WhitespaceChars.space || $ === WhitespaceChars.tab
55
+ ? null
56
+ : relative_position['column'],
57
+ };
58
+ }, () => relative_position //this is weird, we were already at the end of the list
59
+ );
60
+ found_carriage_return_before = c.transform(($) => $ === WhitespaceChars.carriage_return, () => false);
61
+ position += 1;
62
+ };
63
+ return {
64
+ 'consume string': ($) => {
65
+ (0, to_character_list_1.$$)($).__for_each(() => {
66
+ consume_character();
67
+ });
68
+ },
69
+ 'consume character': consume_character,
70
+ 'get current character': () => {
71
+ if (position === length) {
72
+ return null;
73
+ }
74
+ return characters.__get_element_at(position).transform(($) => $, () => null);
75
+ },
76
+ 'look ahead': ($) => {
77
+ const next_position = position + $;
78
+ if (next_position >= length) {
79
+ return null;
80
+ }
81
+ return characters.__get_element_at(next_position).transform(($) => $, () => null);
82
+ },
83
+ 'create location info': () => {
84
+ return {
85
+ 'absolute': position,
86
+ 'relative': {
87
+ 'line': relative_position.line,
88
+ 'column': relative_position['column'],
89
+ }
90
+ };
91
+ },
92
+ 'create offset location info': (subtract) => {
93
+ return {
94
+ 'absolute': position - subtract,
95
+ 'relative': {
96
+ 'line': relative_position.line,
97
+ 'column': relative_position['column'] - subtract,
98
+ }
99
+ };
100
+ },
101
+ 'create location info string': () => `${relative_position.line}:${relative_position['column']}`,
102
+ 'get line indentation': () => {
103
+ return relative_position['line indentation'] !== null
104
+ ? relative_position['line indentation']
105
+ : relative_position['column'];
106
+ },
107
+ 'starts with': ($) => {
108
+ return (0, starts_with_1.$$)(source, $, position);
109
+ }
110
+ };
111
+ };
112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QyxRQUFRLENBQUMsR0FBRyxRQUFRO2lCQUNuRDthQUNKLENBQUE7UUFDTCxDQUFDO1FBQ0QsNkJBQTZCLEVBQUUsR0FBRyxFQUFFLENBQUMsR0FBRyxpQkFBaUIsQ0FBQyxJQUFJLElBQUksaUJBQWlCLENBQUMsUUFBUSxDQUFDLEVBQUU7UUFDL0Ysc0JBQXNCLEVBQUUsR0FBRyxFQUFFO1lBQ3pCLE9BQU8saUJBQWlCLENBQUMsa0JBQWtCLENBQUMsS0FBSyxJQUFJO2dCQUNqRCxDQUFDLENBQUMsaUJBQWlCLENBQUMsa0JBQWtCLENBQUM7Z0JBQ3ZDLENBQUMsQ0FBQyxpQkFBaUIsQ0FBQyxRQUFRLENBQUMsQ0FBQTtRQUNyQyxDQUFDO1FBQ0QsYUFBYSxFQUFFLENBQUMsQ0FBUyxFQUFFLEVBQUU7WUFDekIsT0FBTyxJQUFBLGdCQUFjLEVBQ2pCLE1BQU0sRUFDTixDQUFDLEVBQ0QsUUFBUSxDQUNYLENBQUE7UUFDTCxDQUFDO0tBQ0osQ0FBQTtBQUNMLENBQUMsQ0FBQTtBQXpIWSxRQUFBLHNCQUFzQiwwQkF5SGxDIn0=
@@ -0,0 +1,9 @@
1
+ import * as _out from "../../../../../interface/generated/pareto/core/token";
2
+ import { String_Iterator } from "./string_iterator";
3
+ export declare const Whitespace: (string_iterator: String_Iterator) => _out._T_Whitespace;
4
+ export declare const Trivia: (string_iterator: String_Iterator) => _out._T_Trivia;
5
+ export declare const Annotated_Token: (st: String_Iterator) => _out._T_Annotated_Token;
6
+ export declare const Delimited_String: (string_iterator: String_Iterator, is_end_character: (character: number) => boolean, allow_newlines: boolean) => _out._T_Delimited_String;
7
+ export declare const Tokenizer_Result: ($: null, $p: {
8
+ "string iterator": String_Iterator;
9
+ }) => _out._T_Tokenizer_Result;