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

Argument ranges have a start position later than the end position #77

Closed
rcjsuen opened this issue Apr 4, 2020 · 2 comments
Closed
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Apr 4, 2020

RUN \
  \
\"
RUN \
	\
\"
import { DockerfileParser } from 'dockerfile-ast';

let dockerfile = DockerfileParser.parse("RUN \"\\\n  \\\n\\\"");
let instruction = dockerfile.getInstructions()[0];
console.log(instruction.getArguments().length);
for (const arg of instruction.getArguments()) {
    console.log(arg.getRange());
}

dockerfile = DockerfileParser.parse("RUN \"\\\n\t\\\n\\\"");
instruction = dockerfile.getInstructions()[0];
console.log(instruction.getArguments().length);
for (const arg of instruction.getArguments()) {
    console.log(arg.getRange());
}

Notice here how the second argument has a range with a start position later than the end position.

2
{ start: { line: 0, character: 4 },
  end: { line: 1, character: 2 } }
{ start: { line: 2, character: 0 },
  end: { line: 1, character: 2 } }
2
{ start: { line: 0, character: 4 },
  end: { line: 1, character: 1 } }
{ start: { line: 2, character: 0 },
  end: { line: 1, character: 1 } }
@rcjsuen rcjsuen added the bug label Apr 4, 2020
@rcjsuen rcjsuen self-assigned this Apr 4, 2020
@rcjsuen
Copy link
Owner Author

rcjsuen commented Apr 4, 2020

The Dockerfiles should look like this instead and not what was in the original post.

RUN \"
  \
\"
RUN \"
	\
\"

@rcjsuen
Copy link
Owner Author

rcjsuen commented Apr 4, 2020

Whoops...

RUN "\
  \
\"
RUN "\
	\
\"

@rcjsuen rcjsuen closed this as completed in d1b1bd2 Apr 4, 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