File tree Expand file tree Collapse file tree 2 files changed +87
-12
lines changed Expand file tree Collapse file tree 2 files changed +87
-12
lines changed Original file line number Diff line number Diff line change 22 "cells" : [
33 {
44 "cell_type" : " code" ,
5- "execution_count" : null ,
5+ "execution_count" : 2 ,
66 "id" : " c37e3f66" ,
77 "metadata" : {},
8- "outputs" : [],
8+ "outputs" : [
9+ {
10+ "name" : " stdout" ,
11+ "output_type" : " stream" ,
12+ "text" : [
13+ " Hello world\n "
14+ ]
15+ }
16+ ],
917 "source" : [
1018 " \"\"\" This is a Hello World Program \"\"\"\n " ,
1119 " \n " ,
1624 },
1725 {
1826 "cell_type" : " code" ,
19- "execution_count" : null ,
27+ "execution_count" : 3 ,
2028 "id" : " 87b5906e" ,
2129 "metadata" : {},
30+ "outputs" : [
31+ {
32+ "name" : " stdout" ,
33+ "output_type" : " stream" ,
34+ "text" : [
35+ " 15\n "
36+ ]
37+ }
38+ ],
39+ "source" : [
40+ " \"\"\" Simple Maths \"\"\"\n " ,
41+ " \n " ,
42+ " with entry{\n " ,
43+ " a = 5;\n " ,
44+ " b = 10;\n " ,
45+ " \n " ,
46+ " print(a+b);\n " ,
47+ " }"
48+ ]
49+ },
50+ {
51+ "cell_type" : " code" ,
52+ "execution_count" : 4 ,
53+ "id" : " 83fad64e" ,
54+ "metadata" : {},
55+ "outputs" : [
56+ {
57+ "name" : " stdout" ,
58+ "output_type" : " stream" ,
59+ "text" : [
60+ " Exception: name 'c' is not defined\n " ,
61+ " JacCode Snippet:\n " ,
62+ " 1: \t\"\"\" Simple Maths \"\"\"\n " ,
63+ " 2: \t\n " ,
64+ " 3: \t with entry{\n " ,
65+ " *4: \t a = 5;\n " ,
66+ " 5: \t b = 10;\n " ,
67+ " 6: \t \n " ,
68+ " 7: \t print(c);\n " ,
69+ " PyCode Snippet:\n " ,
70+ " 2: \t from __future__ import annotations\n " ,
71+ " 3: \t a = 5 # 0 4\n " ,
72+ " 4: \t b = 10 # 0 4\n " ,
73+ " *5: \t print(c) # 0 4\n " ,
74+ " 6: \t\n " ,
75+ " 7: \t r\"\"\" JAC DEBUG INFO\n " ,
76+ " 8: \t /var/folders/mm/mlcr8k8n51n66y25lmp08mrm0000gn/T/tmpp71ty4bu/temp.jac\n "
77+ ]
78+ }
79+ ],
80+ "source" : [
81+ " \"\"\" Simple Maths \"\"\"\n " ,
82+ " \n " ,
83+ " with entry{\n " ,
84+ " a = 5;\n " ,
85+ " b = 10;\n " ,
86+ " \n " ,
87+ " print(c);\n " ,
88+ " }"
89+ ]
90+ },
91+ {
92+ "cell_type" : " code" ,
93+ "execution_count" : null ,
94+ "id" : " 269357f3" ,
95+ "metadata" : {},
2296 "outputs" : [],
2397 "source" : []
2498 }
27101 "kernelspec" : {
28102 "display_name" : " Jac" ,
29103 "language" : " " ,
30- "name" : " jackernel"
104+ "name" : " jac_kernel"
105+ },
106+ "language_info" : {
107+ "file_extension" : " .jac" ,
108+ "mimetype" : " text/plain" ,
109+ "name" : " python" ,
110+ "pygments_lexer" : " jac_lexer"
31111 }
32112 },
33113 "nbformat" : 4 ,
Original file line number Diff line number Diff line change 88"""
99
1010import contextlib
11- import os
1211import os .path as op
1312import tempfile
1413from io import StringIO
1514
1615from ipykernel .kernelapp import IPKernelApp
1716from ipykernel .kernelbase import Kernel
1817
19- from jaclang import jac_blue_import as jac_import
2018from jackernel .syntax_hilighter import JacLexer
2119
22- from pygments import lexers
23-
24- # jac_lexer = lexers.load_lexer_from_file("syntax_hilighter.py", "JacLexer")
20+ from jaclang import jac_blue_import as jac_import
2521
2622jac_lexer = JacLexer ()
2723
@@ -95,7 +91,6 @@ def do_execute(
9591 self .send_response (self .iopub_socket , "stream" , stream_content )
9692
9793 except Exception as e :
98- # Send the exception as an error message to the frontend.
9994 error_content = {
10095 "ename" : type (e ).__name__ ,
10196 "evalue" : str (e ),
@@ -111,13 +106,13 @@ def do_execute(
111106 finally :
112107 pass
113108
114- # Return the execution result.
115- return {
109+ execution_result = {
116110 "status" : "ok" ,
117111 "execution_count" : self .execution_count ,
118112 "payload" : [],
119113 "user_expressions" : {},
120114 }
115+ return execution_result
121116
122117
123118if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments