Comments (2)
SetLineState
in Scintilla allows setting lines past the end to make it simpler to implement lexers. TestLexers
is a bit stricter to help uncover problems but its probably reasonable to allow writing just one past the maximum line. Possibly
@@ -196,6 +196,9 @@ int SCI_METHOD TestDocument::GetLineState(Sci_Position line) const {
}
int SCI_METHOD TestDocument::SetLineState(Sci_Position line, int state) {
+ if (line == static_cast<Sci_Position>(lineLevels.size())) {
+ return 0;
+ }
return lineStates.at(line) = state;
}
or
@@ -123,7 +123,7 @@ void TestDocument::Set(std::string_view sv) {
if (lineStarts.back() != Length()) {
lineStarts.push_back(Length());
}
- lineStates.resize(lineStarts.size());
+ lineStates.resize(lineStarts.size() + 1);
lineLevels.resize(lineStarts.size(), 0x400);
}
from lexilla.
Amending the TestDocument module does the trick.
After applying the second option (since they're equivalent and single exit points are ideal), we're left with the following:
Lexing verilog/AllStyles.vh
~/lexilla/test/examples/verilog/AllStyles.vh:66: different styles between \r and \n at 870: 11, 0
~/lexilla/test/examples/verilog/AllStyles.vh:67: different styles between \r and \n at 879: 11, 0
~/lexilla/test/examples/verilog/AllStyles.vh:68: different styles between \r and \n at 888: 11, 0
~/lexilla/test/examples/verilog/AllStyles.vh:69: different styles between \r and \n at 896: 11, 0
~/lexilla/test/examples/verilog/AllStyles.vh:70: different styles between \r and \n at 905: 11, 0
~/lexilla/test/examples/verilog/AllStyles.vh:1: has different styles with \n versus \r\n line ends
Modernizing all cases of StyleContext::atLineEnd
to ::MatchLineEnd()
resolves most of these, leaving a single issue of unclean style switching in the middle of DOS EOLs in the case of SCE_V_STRINGEOL
. Because StyleContext::ForwardSetState()
will only advance the width of a single character, a conditional call to ::Forward()
is needed to span the entire CRLF:
Lines 596 to 598 in 1234892
The diagnostic is not very revealing:
Lexing verilog/AllStyles.vh
~/lexilla/test/examples/verilog/AllStyles.vh:73: different styles between \r and \n at 937: 12, 0
~/lexilla/test/examples/verilog/AllStyles.vh:1: has different styles with \n versus \r\n line ends
This was one case where visual inspection was more productive. In LF mode, SCE_V_STRINGEOL
would fill the line; in CRLF mode, it was trimmed to the length of the string + 1 for the severed CR
.
0002-LexerVerilog-Don-t-split-CRLFs-when-terminating-string-EOL-state.patch.txt
from lexilla.
Related Issues (20)
- Folding incorrect for Python scripts in ASP HTML
- [Ruby] Allow modifier if, unless, while and until after heredoc delimiter
- [lexer] [feature request] add Zig support
- LexRaku confuses an object attribute named y with the y/// operator HOT 1
- Rust: raw identifiers are marked as errors. HOT 1
- [Feature request] Add JSON5 support HOT 1
- LexLua Unicode identifier issue HOT 6
- XML / XSL Lexer HOT 9
- Add single file input for compiler in lexilla.mak HOT 5
- Add Linden Script Language (LSL) as built-in language in Notepad++ HOT 6
- Add User-defined keywords in HTML HOT 3
- Incorrect folding for multi-line literal strings and block comments when performed incrementally HOT 1
- Respect DIR_O for .res files in lexilla.mak
- [HTML, CPP] Add `>` and space into `setOKBeforeJSRE` to fix regex highlighting HOT 2
- [HTML] Add separate keywords for attributes HOT 6
- [HTML, XML] Don't interpret `<?` and `<%` inside CDATA section HOT 14
- Missing shebang support in JavaScript HOT 1
- PowerShell string embedded variables not highlighted correctly HOT 5
- Need CUE sheet syntax highlighting
- Add Excel Formula Lexer
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 lexilla.