Skip to content

Commit

Permalink
Line/column numbers from bigint to number
Browse files Browse the repository at this point in the history
Relevant: <#1 (comment)>.
  • Loading branch information
EthanThatOneKid committed Jun 1, 2023
1 parent cc60c8e commit dffc7a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions parse/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { quotedSplit } from "./quoted_split.ts";
export interface ParsedComment {
args: string[];
original: string;
line: bigint;
character: bigint;
line: number;
character: number;
alias?: string;
}

Expand All @@ -30,15 +30,15 @@ export const DIRECTIVE_PATTERN = /^\/\/deno:generate\s+/;
*/
export async function parseComments(reader: Reader): Promise<ParsedComment[]> {
const comments: ParsedComment[] = [];
let currentLine = BigInt(0);
let currentLine = 0;
for await (const line of readLines(reader)) {
currentLine += BigInt(1);
currentLine++;
if (!DIRECTIVE_PATTERN.test(line)) {
continue;
}

comments.push(
fromComment(line, currentLine.valueOf(), BigInt(0)),
fromComment(line, currentLine, 0),
);
}

Expand All @@ -51,8 +51,8 @@ export async function parseComments(reader: Reader): Promise<ParsedComment[]> {
*/
function fromComment(
comment: string,
line: bigint,
character: bigint,
line: number,
character: number,
): ParsedComment {
// Remove the leading // and trailing whitespace
const original = comment
Expand Down

0 comments on commit dffc7a0

Please sign in to comment.