瀏覽代碼

Update 'js/ast/commands/index.js'

Fixes to solve problem to read 'ivph' file with comments (contribution of Edilson Cuambe)
leo 1 周之前
父節點
當前提交
483429f2bd
共有 1 個文件被更改,包括 21 次插入0 次删除
  1. 21 0
      js/ast/commands/index.js

+ 21 - 0
js/ast/commands/index.js

@@ -15,6 +15,7 @@ import { Case } from './case';
 import { SysCall } from './sysCall';
 import { FormalParameter } from './formalParameter';
 import { FunctionCall } from './../expressions/functionCall'; //Proxy to expression since they do exatcly the same thing
+import { Command } from './command';
 
 export {
   Break,
@@ -34,4 +35,24 @@ export {
   SysCall,
   FormalParameter,
   FunctionCall
+};
+
+export class Comment extends Command {
+  constructor (text, isInline = false, parentCommand = null) {
+    super();
+
+    this.type = "comment";
+    this.comment_text = text;
+    this.comment = text;
+    this.value = text;
+    this._text = text;
+
+    this.isInline = isInline;
+    this.parentCommand = parentCommand;
+  }
+
+  static isInlineComment (comment) {
+    return comment && comment.isInline === true;
+  }
+
 };