Updated indention

Indention was incorrect, fixed.
This commit is contained in:
tel0065 2022-05-05 11:56:39 -05:00 committed by GitHub
parent bb0b1be0d4
commit a10200f2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,7 @@ type Rule = {
* The first item is a recognition pattern, used to recognize the token
* the second item is the token type
*/
const rules: Rule[] = [
{
const rules: Rule[] = [{
pattern: /^\s*def\s+(?<attr>[a-zA-Z_][a-zA-Z0-9_]*)\(/,
type: Symbol.FUNCTION
},
@ -131,8 +130,7 @@ export default class Lexer {
// Yes...
if (match.groups) {
token = new LineToken(r.type, this.pos, indent, match.groups["attr"]);
}
else {
} else {
token = new LineToken(r.type, this.pos, indent);
}
@ -148,8 +146,7 @@ export default class Lexer {
if (/^\s*(#.*)?$/.test(line)) {
// "empty" line
token = new LineToken(Symbol.EMPTY, this.pos, 999999);
}
else {
} else {
// This is an INDENT token
token = new LineToken(Symbol.INDENT, this.pos, indent);
}
@ -218,8 +215,7 @@ export default class Lexer {
if (tabFmt.hard) {
// used tabs
indent = leadingSpace;
}
else {
} else {
// use spaces
indent = Math.ceil(leadingSpace / tabFmt.size!);
}