mirror of
https://github.com/We-Dont-Byte/Mind_Reader.git
synced 2024-11-15 03:35:59 +00:00
Updated indention
Indention was incorrect, fixed.
This commit is contained in:
parent
bb0b1be0d4
commit
a10200f2bc
@ -11,8 +11,7 @@ type Rule = {
|
|||||||
* The first item is a recognition pattern, used to recognize the token
|
* The first item is a recognition pattern, used to recognize the token
|
||||||
* the second item is the token type
|
* 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_]*)\(/,
|
pattern: /^\s*def\s+(?<attr>[a-zA-Z_][a-zA-Z0-9_]*)\(/,
|
||||||
type: Symbol.FUNCTION
|
type: Symbol.FUNCTION
|
||||||
},
|
},
|
||||||
@ -131,8 +130,7 @@ export default class Lexer {
|
|||||||
// Yes...
|
// Yes...
|
||||||
if (match.groups) {
|
if (match.groups) {
|
||||||
token = new LineToken(r.type, this.pos, indent, match.groups["attr"]);
|
token = new LineToken(r.type, this.pos, indent, match.groups["attr"]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
token = new LineToken(r.type, this.pos, indent);
|
token = new LineToken(r.type, this.pos, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +146,7 @@ export default class Lexer {
|
|||||||
if (/^\s*(#.*)?$/.test(line)) {
|
if (/^\s*(#.*)?$/.test(line)) {
|
||||||
// "empty" line
|
// "empty" line
|
||||||
token = new LineToken(Symbol.EMPTY, this.pos, 999999);
|
token = new LineToken(Symbol.EMPTY, this.pos, 999999);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// This is an INDENT token
|
// This is an INDENT token
|
||||||
token = new LineToken(Symbol.INDENT, this.pos, indent);
|
token = new LineToken(Symbol.INDENT, this.pos, indent);
|
||||||
}
|
}
|
||||||
@ -218,8 +215,7 @@ export default 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!);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user