Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instruction that spans multiple lines with an escaped newline at the beginning of the line will throw an error #67

Closed
rcjsuen opened this issue Feb 15, 2020 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Feb 15, 2020

RUN \
"\
\
"

Definitely a rather obscure Dockerfile but looks like our parser is unable to handle it.

import { DockerfileParser } from 'dockerfile-ast';
let dockerfile = DockerfileParser.parse(
    "RUN \\\n" +
    "\"\\\n" +
    "\\\n" +
    "\""
);
let instruction = dockerfile.getInstructions()[0];
console.log(instruction.getArgumentsContent());
.../node_modules/vscode-languageserver-types/lib/umd/main.js:54
                throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
                ^

Error: Range#create called with invalid arguments[null, [object Object], undefined, undefined]
    at Object.create (.../node_modules/vscode-languageserver-types/lib/umd/main.js:54:23)
    at JSONInstruction.getArgumentsRanges (.../out/src/instruction.js:101:69)
    at JSONInstruction.getArgumentsContent (.../out/src/instruction.js:159:27)
    at Object.<anonymous> (.../out/src/test.js:9:25)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
@rcjsuen rcjsuen added the bug label Feb 15, 2020
@rcjsuen rcjsuen self-assigned this Feb 15, 2020
@rcjsuen rcjsuen changed the title Quoted string that spans multiple lines throws an error Instruction that spans multiple lines with an escaped newline at the beginning of the line will throw an error Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant