Просмотр исходного кода

Edited Parser and ParserServer

florian.residori@gmail.com 3 лет назад
Родитель
Сommit
cbde3838fd
2 измененных файлов с 5 добавлено и 5 удалено
  1. 4 4
      client_code/Parser/__init__.py
  2. 1 1
      server_code/ParserServer.py

+ 4 - 4
client_code/Parser/__init__.py

@@ -22,13 +22,13 @@ class Parser(ParserTemplate):
     if status==1:
       self.output.foreground = 'red'
       output_text = ""
-      index = 1
+      index = 0
       for line in self.input.text.splitlines():
         output_text = output_text + line + '\n'
-        index+= 1
         if index == lineno:
           output_text = output_text + ' '*colno + '^' '\n'
-          output_text = output_text + ' '*colno + 'MESSAGE: ' + msg + '\n'
+          output_text = output_text + ' '*colno + 'HERE: ' + msg + ' ----------------------------------------\n'
+        index+= 1
       
     self.output.text = output_text
 
@@ -48,7 +48,7 @@ class Parser(ParserTemplate):
         index+= 1
         if index == lineno:
           output_text = output_text + ' '*colno + '^' '\n'
-          output_text = output_text + ' '*colno + 'MESSAGE: ' + msg + '\n'
+          output_text = output_text + ' '*colno + 'HERE: ' + msg + ' ----------------------------------------\n'
       
     self.output.text = output_text
 

+ 1 - 1
server_code/ParserServer.py

@@ -19,7 +19,7 @@ def parse_yaml(yaml_data):
   try:
     return (0,pprint.pformat(yaml.safe_load(yaml_data), indent=2),"",0,0)
   except yaml.YAMLError as exc:
-    return (1,pprint.pformat(yaml_data, indent=2), exc.msg, exc.lineno, exc.colno)
+    return (1,pprint.pformat(yaml_data, indent=2), exc.problem, exc.problem_mark.line, exc.problem_mark.column)
 
 
 @anvil.server.callable