Skip to content

Commit

Permalink
Merge branch 'main' of github.com:benson1029/go-slang into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rama-pang committed Apr 3, 2024
2 parents 931ee22 + dc7d55e commit e61d8fd
Show file tree
Hide file tree
Showing 23 changed files with 1,313 additions and 31 deletions.
14 changes: 14 additions & 0 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';

const config: Config = {
title: 'Go Interpreter Specification',
Expand Down Expand Up @@ -36,6 +38,8 @@ const config: Config = {
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
theme: {
customCss: './src/css/custom.css',
Expand Down Expand Up @@ -82,6 +86,16 @@ const config: Config = {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],

stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
type: 'text/css',
integrity:
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
crossorigin: 'anonymous',
},
],
};

export default config;
217 changes: 216 additions & 1 deletion docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react-dom": "^18.0.0",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.1.1",
Expand Down
19 changes: 16 additions & 3 deletions src/go/ece/loader/globalSort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ function sort_global_declarations(program: any, imports: any[], default_imports:
if (stmt.tag === "struct-method" && ignore_structs) continue;
if (stmt.tag === "struct") {
for (let ref of stmt.fields) {
if (ref.type.tag === "struct-decl-type") {
back_edges[get_name(stmt)].push(ref.type.name);
edges[ref.type.name].push(get_name(stmt));
let dfs = (type: any) => {
if (type.tag === "struct-decl-type") {
back_edges[get_name(stmt)].push(type.name);
edges[type.name].push(get_name(stmt));
} else if (type.tag === "array-type") {
dfs(type.type);
}
}
dfs(ref.type);
}
continue;
}
Expand Down Expand Up @@ -230,6 +235,14 @@ function sort_global_declarations(program: any, imports: any[], default_imports:
}
return 0;
});

// Remove the METHOD. captures.
for (let stmt of program.body) {
if (stmt.tag === "struct") continue;
stmt.captures = stmt.captures.filter((ref: any) => {
return !ref.name.startsWith("METHOD.");
});
}
}

export { sort_global_declarations };
Loading

0 comments on commit e61d8fd

Please sign in to comment.