Rename directory "engines" to "languages"

This commit is contained in:
Nilay Majorwar 2022-01-30 20:47:33 +05:30
parent 0bf7c0de3a
commit e3be5a8a83
82 changed files with 27 additions and 21 deletions

View File

@ -3,7 +3,7 @@ import { NextPage } from "next";
import Head from "next/head"; import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe"; import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header"; import { Header } from "../../ui/header";
import LangProvider from "../../engines/befunge93"; import LangProvider from "../../languages/befunge93";
const LANG_ID = "befunge93"; const LANG_ID = "befunge93";
const LANG_NAME = "Befunge-93"; const LANG_NAME = "Befunge-93";

View File

@ -3,7 +3,7 @@ import { NextPage } from "next";
import Head from "next/head"; import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe"; import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header"; import { Header } from "../../ui/header";
import LangProvider from "../../engines/brainfuck"; import LangProvider from "../../languages/brainfuck";
const LANG_ID = "brainfuck"; const LANG_ID = "brainfuck";
const LANG_NAME = "Brainfuck"; const LANG_NAME = "Brainfuck";

View File

@ -3,7 +3,7 @@ import { NextPage } from "next";
import Head from "next/head"; import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe"; import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header"; import { Header } from "../../ui/header";
import LangProvider from "../../engines/chef"; import LangProvider from "../../languages/chef";
const LANG_ID = "chef"; const LANG_ID = "chef";
const LANG_NAME = "Chef"; const LANG_NAME = "Chef";

View File

@ -3,7 +3,7 @@ import { NextPage } from "next";
import Head from "next/head"; import Head from "next/head";
import { Mainframe } from "../../ui/Mainframe"; import { Mainframe } from "../../ui/Mainframe";
import { Header } from "../../ui/header"; import { Header } from "../../ui/header";
import LangProvider from "../../engines/deadfish"; import LangProvider from "../../languages/deadfish";
const LANG_ID = "deadfish"; const LANG_ID = "deadfish";
const LANG_NAME = "Deadfish"; const LANG_NAME = "Deadfish";

View File

@ -14,7 +14,7 @@ if (!langId || !langName) {
} }
// Check if language provider directory already exists // Check if language provider directory already exists
const dir = path.resolve(__dirname, "../engines/", langId); const dir = path.resolve(__dirname, "../languages/", langId);
if (fs.existsSync(dir)) { if (fs.existsSync(dir)) {
console.log(`Language ID '${langId}' already exists.`); console.log(`Language ID '${langId}' already exists.`);
process.exit(0); process.exit(0);

View File

@ -3,11 +3,11 @@ import { CodeEditor, CodeEditorRef } from "../ui/code-editor";
import { InputEditor, InputEditorRef } from "../ui/input-editor"; import { InputEditor, InputEditorRef } from "../ui/input-editor";
import { MainLayout } from "../ui/MainLayout"; import { MainLayout } from "../ui/MainLayout";
import { useExecController } from "../ui/use-exec-controller"; import { useExecController } from "../ui/use-exec-controller";
import { LanguageProvider, StepExecutionResult } from "../engines/types"; import { LanguageProvider, StepExecutionResult } from "../languages/types";
import { OutputViewer, OutputViewerRef } from "../ui/output-viewer"; import { OutputViewer, OutputViewerRef } from "../ui/output-viewer";
import { ExecutionControls } from "./execution-controls"; import { ExecutionControls } from "./execution-controls";
import { RendererRef, RendererWrapper } from "./renderer-wrapper"; import { RendererRef, RendererWrapper } from "./renderer-wrapper";
import { WorkerRuntimeError } from "../engines/worker-errors"; import { WorkerRuntimeError } from "../languages/worker-errors";
type Props<RS> = { type Props<RS> = {
langName: string; langName: string;

View File

@ -5,7 +5,7 @@ import {
DocumentEdit, DocumentEdit,
DocumentRange, DocumentRange,
MonacoTokensProvider, MonacoTokensProvider,
} from "../../engines/types"; } from "../../languages/types";
import { import {
createHighlightRange, createHighlightRange,
createMonacoDocEdit, createMonacoDocEdit,
@ -16,7 +16,7 @@ import { useEditorBreakpoints } from "./use-editor-breakpoints";
import darkTheme from "./themes/dark.json"; import darkTheme from "./themes/dark.json";
import lightTheme from "./themes/light.json"; import lightTheme from "./themes/light.json";
import { useDarkMode } from "../providers/dark-mode-provider"; import { useDarkMode } from "../providers/dark-mode-provider";
import { WorkerParseError } from "../../engines/worker-errors"; import { WorkerParseError } from "../../languages/worker-errors";
import { useCodeValidator } from "./use-code-validator"; import { useCodeValidator } from "./use-code-validator";
/** Keeps track of user's original program and modifications done to it */ /** Keeps track of user's original program and modifications done to it */

View File

@ -1,6 +1,6 @@
import monaco from "monaco-editor"; import monaco from "monaco-editor";
import { DocumentEdit, DocumentRange } from "../../engines/types"; import { DocumentEdit, DocumentRange } from "../../languages/types";
import { WorkerParseError } from "../../engines/worker-errors"; import { WorkerParseError } from "../../languages/worker-errors";
/** Type alias for an instance of Monaco editor */ /** Type alias for an instance of Monaco editor */
export type EditorInstance = monaco.editor.IStandaloneCodeEditor; export type EditorInstance = monaco.editor.IStandaloneCodeEditor;

View File

@ -1,5 +1,5 @@
import * as React from "react"; import * as React from "react";
import { WorkerParseError } from "../../engines/worker-errors"; import { WorkerParseError } from "../../languages/worker-errors";
import { import {
createValidationMarker, createValidationMarker,
EditorInstance, EditorInstance,

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { useMonaco } from "@monaco-editor/react"; import { useMonaco } from "@monaco-editor/react";
import { MonacoTokensProvider } from "../../engines/types"; import { MonacoTokensProvider } from "../../languages/types";
type ConfigParams = { type ConfigParams = {
languageId: string; languageId: string;

View File

@ -1,6 +1,9 @@
import React from "react"; import React from "react";
import { Colors, Text } from "@blueprintjs/core"; import { Colors, Text } from "@blueprintjs/core";
import { WorkerParseError, WorkerRuntimeError } from "../engines/worker-errors"; import {
WorkerParseError,
WorkerRuntimeError,
} from "../languages/worker-errors";
/** Format a ParseError for displaying as output */ /** Format a ParseError for displaying as output */
const formatParseError = (error: WorkerParseError): string => { const formatParseError = (error: WorkerParseError): string => {

View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { LanguageProvider } from "../engines/types"; import { LanguageProvider } from "../languages/types";
export interface RendererRef<RS> { export interface RendererRef<RS> {
/** Update runtime state to renderer */ /** Update runtime state to renderer */

View File

@ -1,10 +1,13 @@
import React from "react"; import React from "react";
import { StepExecutionResult } from "../engines/types"; import { StepExecutionResult } from "../languages/types";
import { import {
WorkerRequestData, WorkerRequestData,
WorkerResponseData, WorkerResponseData,
} from "../engines/worker-constants"; } from "../languages/worker-constants";
import { WorkerParseError, WorkerRuntimeError } from "../engines/worker-errors"; import {
WorkerParseError,
WorkerRuntimeError,
} from "../languages/worker-errors";
import { useErrorBoundary } from "./providers/error-boundary-provider"; import { useErrorBoundary } from "./providers/error-boundary-provider";
/** Possible states for the worker to be in */ /** Possible states for the worker to be in */

View File

@ -1,14 +1,14 @@
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const langNames = fs.readdirSync("engines").filter((name) => { const langNames = fs.readdirSync("languages").filter((name) => {
const stats = fs.statSync(`./engines/${name}`); const stats = fs.statSync(`./languages/${name}`);
return stats.isDirectory(); return stats.isDirectory();
}); });
const entryPoints = {}; const entryPoints = {};
for (const lang of langNames) { for (const lang of langNames) {
entryPoints[lang] = `./engines/${lang}/engine.ts`; entryPoints[lang] = `./languages/${lang}/engine.ts`;
} }
console.log(path.resolve(__dirname, "worker-pack/tsconfig.json")); console.log(path.resolve(__dirname, "worker-pack/tsconfig.json"));