mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 15:05:25 +00:00
Fix #207 uppercaseOnly BASIC dialects
uppercaseOnly BASIC dialects will remain uppercase only even when loaded with compile errors.
This commit is contained in:
1 parent
eaf2db15e6
commit
33fdc28e16
5 files changed
+12
-5
No files matched your search
@@ -138,6 +138,7 @@ export interface WorkerUnchangedResult {
|
||||
export interface WorkerErrorResult {
|
||||
errors: WorkerError[]
|
||||
listings?: CodeListingMap
|
||||
uppercaseOnly?: boolean
|
||||
}
|
||||
|
||||
export interface WorkerOutputResult<T> {
|
||||
@@ -147,6 +148,7 @@ export interface WorkerOutputResult<T> {
|
||||
params?: {}
|
||||
segments?: Segment[]
|
||||
debuginfo?: {} // optional info
|
||||
uppercaseOnly?: boolean
|
||||
}
|
||||
|
||||
export function isUnchanged(result: WorkerResult) : result is WorkerUnchangedResult {
|
||||
|
||||
+4
-1
@@ -21,7 +21,7 @@ import { Toolbar } from "./toolbar";
|
||||
import { AssetEditorView } from "./views/asseteditor";
|
||||
import { isMobileDevice } from "./views/baseviews";
|
||||
import { AddressHeatMapView, BinaryFileView, MemoryMapView, MemoryView, ProbeLogView, ProbeSymbolView, RasterStackMapView, ScanlineIOView, VRAMMemoryView } from "./views/debugviews";
|
||||
import { DisassemblerView, ListingView, PC_LINE_LOOKAHEAD, SourceEditor } from "./views/editors";
|
||||
import { DisassemblerView, ListingView, PC_LINE_LOOKAHEAD, SourceEditor, setUppercaseOnly } from "./views/editors";
|
||||
import { CallStackView, DebugBrowserView } from "./views/treeviews";
|
||||
import { ProjectWindows } from "./windows";
|
||||
import Split = require('split.js');
|
||||
@@ -908,6 +908,9 @@ function showExceptionAsError(err, msg: string) {
|
||||
}
|
||||
|
||||
async function setCompileOutput(data: WorkerResult) {
|
||||
if ('uppercaseOnly' in data) {
|
||||
setUppercaseOnly(data.uppercaseOnly);
|
||||
}
|
||||
// errors? mark them in editor
|
||||
if ('errors' in data && data.errors.length > 0) {
|
||||
toolbar.addClass("has-errors");
|
||||
|
||||
@@ -60,6 +60,10 @@ export var textMapFunctions = {
|
||||
input: null as ((text: string) => string) | null
|
||||
};
|
||||
|
||||
export function setUppercaseOnly(uppercaseOnly: boolean) {
|
||||
textMapFunctions.input = uppercaseOnly ? (s) => s.toUpperCase() : null;
|
||||
}
|
||||
|
||||
export class SourceEditor implements ProjectView {
|
||||
constructor(path: string, mode: string) {
|
||||
this.path = path;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
import { Platform, BreakpointCallback, DebugCondition, DebugEvalCondition } from "../common/baseplatform";
|
||||
import { PLATFORMS, AnimationTimer, EmuHalt } from "../common/emu";
|
||||
import * as editors from "../ide/views/editors";
|
||||
import { BASICRuntime } from "../common/basic/runtime";
|
||||
import { BASICProgram } from "../common/basic/compiler";
|
||||
import { TeleTypeWithKeyboard } from "../common/teletype";
|
||||
@@ -133,8 +132,6 @@ class BASICPlatform implements Platform {
|
||||
this.program = data;
|
||||
var resumePC = this.runtime.load(data);
|
||||
this.tty.uppercaseOnly = true; // this.program.opts.uppercaseOnly; //TODO?
|
||||
// map editor to uppercase-only if need be
|
||||
editors.textMapFunctions.input = this.program.opts.uppercaseOnly ? (s) => s.toUpperCase() : null;
|
||||
// only reset if we exited, or couldn't restart at label (PC reset to 0)
|
||||
if (!this.hotReload || didExit || !resumePC)
|
||||
this.reset();
|
||||
|
||||
@@ -128,7 +128,7 @@ export function compileBASIC(step: BuildStep): WorkerResult {
|
||||
if (parser.errors.length == 0) throw e;
|
||||
}
|
||||
if (parser.errors.length) {
|
||||
return { errors: parser.errors };
|
||||
return { errors: parser.errors, uppercaseOnly: parser.opts.uppercaseOnly };
|
||||
}
|
||||
// put AST into JSON (sans source locations) to see if it has changed
|
||||
var json = JSON.stringify(ast, (key, value) => { return (key == '$loc' ? undefined : value) });
|
||||
@@ -136,6 +136,7 @@ export function compileBASIC(step: BuildStep): WorkerResult {
|
||||
if (anyTargetChanged(step, [jsonpath])) return {
|
||||
output: ast,
|
||||
listings: parser.getListings(),
|
||||
uppercaseOnly: parser.opts.uppercaseOnly,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user