mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-15 03:35:59 +00:00
.js -> .ts
migrating changes made in .js file to .ts, .js file was unintended to be uploaded. User error to blame, fixing it.
This commit is contained in:
parent
9062c253cf
commit
829a3f0b9d
@ -1,5 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
const _1 = require(".");
|
const _1 = require(".");
|
||||||
const token_1 = require("./token");
|
const token_1 = require("./token");
|
||||||
/**
|
/**
|
||||||
@ -67,7 +69,10 @@ class Lexer {
|
|||||||
this.pos = 0;
|
this.pos = 0;
|
||||||
this._currToken = token_1.EOFTOKEN;
|
this._currToken = token_1.EOFTOKEN;
|
||||||
// default is 4 wide expanded tabs
|
// default is 4 wide expanded tabs
|
||||||
this.tabFmt = Object.assign({ size: 4, hard: false }, tabFmt);
|
this.tabFmt = Object.assign({
|
||||||
|
size: 4,
|
||||||
|
hard: false
|
||||||
|
}, tabFmt);
|
||||||
if (text) {
|
if (text) {
|
||||||
// normalize linefeeds
|
// normalize linefeeds
|
||||||
text = text.replace('\r\n', '\n');
|
text = text.replace('\r\n', '\n');
|
||||||
@ -89,8 +94,7 @@ class Lexer {
|
|||||||
if (tabFmt.hard) {
|
if (tabFmt.hard) {
|
||||||
// used tabs
|
// used tabs
|
||||||
indent = leadingSpace;
|
indent = leadingSpace;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// use spaces
|
// use spaces
|
||||||
indent = Math.ceil(leadingSpace / tabFmt.size);
|
indent = Math.ceil(leadingSpace / tabFmt.size);
|
||||||
}
|
}
|
||||||
@ -138,7 +142,9 @@ class Lexer {
|
|||||||
/**
|
/**
|
||||||
* @return the current {@link LineToken}.
|
* @return the current {@link LineToken}.
|
||||||
*/
|
*/
|
||||||
currToken() { return this._currToken; }
|
currToken() {
|
||||||
|
return this._currToken;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Advance the position in the token stream.
|
* Advance the position in the token stream.
|
||||||
*
|
*
|
||||||
@ -160,8 +166,7 @@ class Lexer {
|
|||||||
// Yes...
|
// Yes...
|
||||||
if (match.groups) {
|
if (match.groups) {
|
||||||
token = new _1.LineToken(r.type, this.pos, indent, match.groups["attr"]);
|
token = new _1.LineToken(r.type, this.pos, indent, match.groups["attr"]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
token = new _1.LineToken(r.type, this.pos, indent);
|
token = new _1.LineToken(r.type, this.pos, indent);
|
||||||
}
|
}
|
||||||
this._currToken = token;
|
this._currToken = token;
|
||||||
@ -174,8 +179,7 @@ class Lexer {
|
|||||||
if (/^\s*(#.*)?$/.test(line)) {
|
if (/^\s*(#.*)?$/.test(line)) {
|
||||||
// "empty" line
|
// "empty" line
|
||||||
token = new _1.LineToken(token_1.Symbol.EMPTY, this.pos, 999999);
|
token = new _1.LineToken(token_1.Symbol.EMPTY, this.pos, 999999);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// This is an INDENT token
|
// This is an INDENT token
|
||||||
token = new _1.LineToken(token_1.Symbol.INDENT, this.pos, indent);
|
token = new _1.LineToken(token_1.Symbol.INDENT, this.pos, indent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user