Allow string as Namespace

This commit is contained in:
K35 2022-01-07 11:59:19 +00:00
parent 983ba1f870
commit bb46da08de
3 changed files with 15 additions and 3 deletions

View File

@ -9831,7 +9831,13 @@ function parse(tokens, file) {
const parseDefine = () => {
const idx = eatToken("define");
let [key] = eatText();
let [value] = eatText();
let value = void 0;
if (currentToken.type == "string") {
value = currentToken.value.slice(1, -1);
eatToken();
} else {
[value] = eatText();
}
eatToken(";");
return {
type: "define",

View File

@ -1,6 +1,6 @@
{
"name": "@hibas123/jrpcgen",
"version": "1.0.14",
"version": "1.0.15",
"main": "lib/index.js",
"license": "MIT",
"packageManager": "yarn@3.1.1",

View File

@ -426,7 +426,13 @@ export default function parse(tokens: Token[], file: string): Parsed {
const idx = eatToken("define");
let [key] = eatText()
let [value] = eatText()
let value: string = undefined;
if(currentToken.type == "string") {
value = currentToken.value.slice(1,-1);
eatToken();
} else {
[value] = eatText()
}
eatToken(";");