Comments (4)
Looking at this. Since the lexer only parses \r
and \n
as line terminators, the \r\n
terminator is making the fix a bit uglier. One work around to this would be to parse all consecutive \n
characters after the first \r
or \n
in a string literal. Is that fine?
from quick-lint-js.
Since the lexer only parses
\r
and\n
as line terminators, the\r\n
terminator is making the fix a bit uglier.
I don't know what would be uglier about handling CRLF (\r\n
). Can you show some code?
Code exists in locator::cache_offsets_of_lines (src/location.cpp) to parse CRLF. I'm a bit surprised we don't already have anything in lexer to deal with CRLF. I guess we haven't needed it yet.
One work around to this would be to parse all consecutive \n characters after the first \r or \n in a string literal. Is that fine?
Wouldn't that make the following code lex differently depending on whether CRLF (\r\n
) or LF (\n
) is used for terminating lines?
let x = "hello
world";
from quick-lint-js.
I don't know what would be uglier about handling CRLF (
\r\n
). Can you show some code?Code exists in locator::cache_offsets_of_lines (src/location.cpp) to parse CRLF. I'm a bit surprised we don't already have anything in lexer to deal with CRLF. I guess we haven't needed it yet.
I will follow that example to add CRLF parsing to the lexer.
Wouldn't that make the following code lex differently depending on whether CRLF (
\r\n
) or LF (\n
) is used for terminating lines?let x = "hello world";
Woops, you're right. I didn't think it through far enough.
from quick-lint-js.
Looks like this is working well in commit b879f51.
from quick-lint-js.
Related Issues (20)
- 10$: warn on unsupported JSX HTML entities (e.g. ;)
- error on merged class/interface with mixed exportness (sorta)
- bug(typescript): quick-lint crashes with unclosed TSX JavaScript expression-thingy `{` HOT 1
- add svelte support HOT 1
- refactor: move duplicate 'default' export detection into Variable_Analyzer HOT 1
- 30$: report misleading indentation for braceless if/etc. HOT 1
- 8$: report E0429 for class 'extends' clause
- 10$: disallow newline after 'in'/'out'/'const' modifier in generic parameter list
- 8$: improve diagnostic for <A<B>> </A<B>>
- 10$: don't error on class with same name as aliased empty namespace
- 12$: parse or error on UTF-16 files
- look up TypeScript parameter decorators in correct scope
- error on parameter decorator in overload signature
- 10$: improve diagnostics for missing parameter name
- duplicate export detection is buggy
- 10$: warn on using . after ?. HOT 2
- figure out rules with 'declare global' and non-shadowable globals
- build failure on iwarilama's Mac HOT 2
- improve name of manual builds
- 12$: warn on 'x == y;' statement
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quick-lint-js.