Comments (10)
Pull request committed with minor changes.
Credited to "riQQ". If you want a different name in the credits then tell me.
from lexilla.
It would help to include a link to documentation of the expansion modifier syntax.
from lexilla.
Only %~dp0 should be highlighted as a batch identifier instead of %~dp09.
I see different editors do it differently:
- VSC
~dp0
- Sublime Text
%~dp0
- all based on Scintilla
%~dp09
Regardless, 9
should not be taken into account, because it's just string, like echo %~dp0hello
or echo %~dp0 hello
.
It may be useful:
https://ss64.com/nt/syntax-args.html
Running for /?
in cmd will return some information:
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
environment variable for %I and expands to the
drive letter and path of the first one found.
%~ftzaI - expands %I to a DIR like output line
In the above examples %I and PATH can be replaced by other valid
values. The %~ syntax is terminated by a valid FOR variable name.
Picking upper case variable names like %I makes it more readable and
avoids confusion with the modifiers, which are not case sensitive.
from lexilla.
The code that implements this is around line 404 of LexBatch.cxx. Changing it is complicated by the need to update several variables to retreat back past additional characters to the digit.
from lexilla.
That's fine, thanks.
from lexilla.
Came here for 1 more special case:
for /F "tokens=1,3,4 delims=:" %%a in ("!inioff!") do (
set "inioff=%%~a"
set "base=%%~b"
set /A "size=%%~c" )
"
is also colorized. The %%~
type variable ending recognition needs to be improved if there is "
(and other special characters).
It can be observed in (tested):
Lines 400 to 450 in e9bf225
Initial discussion at zufuliu/notepad4#332 (comment) as the item 1.
from lexilla.
Patch:
Improve-ending-recognition-of-batch-variable-expansion.zip
from lexilla.
Committed b39c460 patch with some changes to x.bat.styled and x.bat.folded. The patch was a little strange as it appeared to be making new x.bat.styled.new and x.bat.folded.new files but with just the new text as if they were based on a shortened version of x.bat with just the new examples.
Its perfectly OK to provide a new example file (and its processed forms) just for a bug. For example, test/examples/markdown/Bug2235.md.
When adding to an existing example, run the tester, check the resulting .new files then rename them without the .new (replacing the old .styled/.folded) then include these modifications in the patch.
from lexilla.
OK, got it. I misunderstood the test part, thought the owner will do the final step 😅, as drawn by the popup https://github.com/ScintillaOrg/lexilla/blob/e9bf2252938311d2c75119a59cf776885c5e224e/CONTRIBUTING#L6-L10
:
Lines 6 to 10 in e9bf225
Thanks for your effort!
As we use git/hg, changes can be easily traced, may just patching the .styled/.folded files be OK?
from lexilla.
There's more explanation further on in CONTRIBUTING. Sending patches containing just the additions is good.
from lexilla.
Related Issues (20)
- [HTML] Update comment highlighting to match WHATWG HTML standard HOT 4
- [Ruby] Correct DBCS character handling HOT 2
- [Ruby] Allow non-ASCII character as heredoc delimiter initial character. HOT 2
- 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
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.