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

enh(nsis) Update defines pattern #3417

Merged
merged 6 commits into from Dec 3, 2021
Merged

enh(nsis) Update defines pattern #3417

merged 6 commits into from Dec 3, 2021

Conversation

idleberg
Copy link
Contributor

@idleberg idleberg commented Dec 3, 2021

Updates pattern for NSIS defines to allow !-characters. This example from the NSIS wiki has an example that uses this.

Changes

Allow ! in defines regex pattern

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@joshgoebel
Copy link
Member

I see a lot of ! there (following your link), can you point me to exactly which part we're talking about?

@idleberg
Copy link
Contributor Author

idleberg commented Dec 3, 2021

I see a lot of ! there (following your link), can you point me to exactly which part we're talking about?

This is the relevant line:

!define !defineifexist "!insertmacro !defineifexist"

It's basically a shortcut that assigns the !insertmacro instruction to a definition. The following two do the same:

# Default !insertmacro syntax
!insertmacro !defineexists [params]

# Shortcut for !insertmacro
${!defineexist} [params]

PS: Unlike variables, defines can begin with any allowed characters – including ! and .

@idleberg
Copy link
Contributor Author

idleberg commented Dec 3, 2021

Since I think the syntax in the linked example is kind of terrible, here's a version that only uses ! where necessary:

!macro DefineIfExist _VAR_NAME _FILE_NAME
	# macro code omitted for brevity
!macroend
!define !defineifexist "!insertmacro DefineIfExist"

In NSIS, all compile-time commands begin with a !. I guess the author's intention to name the definition as !defineifexists was to reflect that his macro does compile-time operations. It could be named anything.

CHANGES.md Outdated
@@ -16,6 +16,7 @@ Grammars:
- enh(clojure) Add `regex` mode to regex literal
- fix(clojure) Remove inconsistent/broken highlighting for metadata
- enh(clojure) Add `punctuation` mode for commas.
- enh(nsis) Update defines pattern to allow `!` (#3417) [idleberg][]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add your name around line ~30 also. Each version needs the name repeated, even if you've contributed in the past.

Copy link
Member

@joshgoebel joshgoebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs name attribution for changelog.

@joshgoebel joshgoebel merged commit b1990ce into highlightjs:main Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants