summaryrefslogtreecommitdiff
path: root/toml/parser.ts
diff options
context:
space:
mode:
Diffstat (limited to 'toml/parser.ts')
-rw-r--r--toml/parser.ts20
1 files changed, 5 insertions, 15 deletions
diff --git a/toml/parser.ts b/toml/parser.ts
index c615c3c1e..cc96322fb 100644
--- a/toml/parser.ts
+++ b/toml/parser.ts
@@ -1,6 +1,4 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { existsSync } from "../fs/exists.ts";
-import { readFileStrSync } from "../fs/read_file_str.ts";
import { deepAssign } from "../util/deep_assign.ts";
import { pad } from "../strings/pad.ts";
@@ -275,12 +273,12 @@ class Parser {
_parseDeclarationName(declaration: string): string[] {
const out = [];
let acc = [];
- let inLitteral = false;
+ let inLiteral = false;
for (let i = 0; i < declaration.length; i++) {
const c = declaration[i];
switch (c) {
case ".":
- if (!inLitteral) {
+ if (!inLiteral) {
out.push(acc.join(""));
acc = [];
} else {
@@ -288,10 +286,10 @@ class Parser {
}
break;
case `"`:
- if (inLitteral) {
- inLitteral = false;
+ if (inLiteral) {
+ inLiteral = false;
} else {
- inLitteral = true;
+ inLiteral = true;
}
break;
default:
@@ -538,11 +536,3 @@ export function parse(tomlString: string): object {
tomlString = tomlString.replace(/\r\n/g, "\n").replace(/\\\n/g, "\n");
return new Parser(tomlString).parse();
}
-
-export function parseFile(filePath: string): object {
- if (!existsSync(filePath)) {
- throw new Error("File not found");
- }
- const strFile = readFileStrSync(filePath);
- return parse(strFile);
-}