webgal-parser 4.6.1 → 4.6.3-beta.1

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.
@@ -6,6 +6,8 @@ export interface sceneEntry {
6
6
  sceneName: string;
7
7
  sceneUrl: string;
8
8
  continueLine: number;
9
+ locals?: Record<string, any>;
10
+ writeReturnTo?: string;
9
11
  }
10
12
  /**
11
13
  * 场景栈条目接口 (兼容性别名)
@@ -38,7 +38,8 @@ export declare enum commandType {
38
38
  getUserInput = 31,
39
39
  applyStyle = 32,
40
40
  wait = 33,
41
- callSteam = 34
41
+ callSteam = 34,
42
+ return = 35
42
43
  }
43
44
  /**
44
45
  * 单个参数接口
@@ -70,6 +71,15 @@ export interface ISentence {
70
71
  sentenceAssets: Array<IAsset>;
71
72
  subScene: Array<string>;
72
73
  inlineComment: string;
74
+ /**
75
+ * 本语句在原始场景文件中占据的行范围(0-based,含首尾)。
76
+ * 单行语句 startLine === endLine;多行语句 endLine 指向最后一条续行。
77
+ * 图形编辑器据此做「只替换被编辑语句所占的行」。
78
+ */
79
+ startLine: number;
80
+ endLine: number;
81
+ /** 本条是多行语句被折叠掉的续行占位,仅用于补齐行数,不应展示给用户 */
82
+ isLineBreakHolder: boolean;
73
83
  }
74
84
  /**
75
85
  * 场景接口
@@ -9,3 +9,13 @@
9
9
  * @returns The processed scene text
10
10
  */
11
11
  export declare function sceneTextPreProcess(sceneText: string): string;
12
+ /**
13
+ * 占位行的前缀。占位行本身是一条注释,引擎会空跑掉;
14
+ * 它的作用是让预处理后的行数与原始场景一致,从而保持
15
+ * 「解析后语句 index == 文件行号」这一不变量。
16
+ */
17
+ export declare const WEBGAL_LINE_BREAK_MARK = ";_WEBGAL_LINE_BREAK_";
18
+ /**
19
+ * 判断预处理后的某一行是否是占位行,即它是上一条多行语句折叠掉的续行。
20
+ */
21
+ export declare function isLineBreakPlaceholder(processedLine: string): boolean;
@@ -3,7 +3,7 @@ import { WebgalConfig } from './configParser/configParser';
3
3
  import { fileType } from './interface/assets';
4
4
  import { IAsset } from './interface/sceneInterface';
5
5
  import { IWebGALStyleObj } from "./styleParser";
6
- import { sceneTextPreProcess } from "./sceneTextPreProcessor";
6
+ import { isLineBreakPlaceholder, sceneTextPreProcess, WEBGAL_LINE_BREAK_MARK } from "./sceneTextPreProcessor";
7
7
  export default class SceneParser {
8
8
  private readonly assetsPrefetcher;
9
9
  private readonly assetSetter;
@@ -23,4 +23,4 @@ export default class SceneParser {
23
23
  parseScssToWebgalStyleObj(scssString: string): IWebGALStyleObj;
24
24
  }
25
25
  export { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG };
26
- export { sceneTextPreProcess };
26
+ export { sceneTextPreProcess, isLineBreakPlaceholder, WEBGAL_LINE_BREAK_MARK };
@@ -6,6 +6,8 @@ export interface sceneEntry {
6
6
  sceneName: string;
7
7
  sceneUrl: string;
8
8
  continueLine: number;
9
+ locals?: Record<string, any>;
10
+ writeReturnTo?: string;
9
11
  }
10
12
  /**
11
13
  * 场景栈条目接口 (兼容性别名)
@@ -38,7 +38,8 @@ export declare enum commandType {
38
38
  getUserInput = 31,
39
39
  applyStyle = 32,
40
40
  wait = 33,
41
- callSteam = 34
41
+ callSteam = 34,
42
+ return = 35
42
43
  }
43
44
  /**
44
45
  * 单个参数接口
@@ -70,6 +71,15 @@ export interface ISentence {
70
71
  sentenceAssets: Array<IAsset>;
71
72
  subScene: Array<string>;
72
73
  inlineComment: string;
74
+ /**
75
+ * 本语句在原始场景文件中占据的行范围(0-based,含首尾)。
76
+ * 单行语句 startLine === endLine;多行语句 endLine 指向最后一条续行。
77
+ * 图形编辑器据此做「只替换被编辑语句所占的行」。
78
+ */
79
+ startLine: number;
80
+ endLine: number;
81
+ /** 本条是多行语句被折叠掉的续行占位,仅用于补齐行数,不应展示给用户 */
82
+ isLineBreakHolder: boolean;
73
83
  }
74
84
  /**
75
85
  * 场景接口
@@ -9,3 +9,13 @@
9
9
  * @returns The processed scene text
10
10
  */
11
11
  export declare function sceneTextPreProcess(sceneText: string): string;
12
+ /**
13
+ * 占位行的前缀。占位行本身是一条注释,引擎会空跑掉;
14
+ * 它的作用是让预处理后的行数与原始场景一致,从而保持
15
+ * 「解析后语句 index == 文件行号」这一不变量。
16
+ */
17
+ export declare const WEBGAL_LINE_BREAK_MARK = ";_WEBGAL_LINE_BREAK_";
18
+ /**
19
+ * 判断预处理后的某一行是否是占位行,即它是上一条多行语句折叠掉的续行。
20
+ */
21
+ export declare function isLineBreakPlaceholder(processedLine: string): boolean;