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

Stan updates #3413

Merged
merged 35 commits into from Dec 14, 2021
Merged

Stan updates #3413

merged 35 commits into from Dec 14, 2021

Conversation

spinkney
Copy link
Contributor

@spinkney spinkney commented Nov 30, 2021

Resolves #3410

Changes

Updated Stan highlighter for Stan version 2.28

  • complex and array types
  • complex numbers
  • added all new functions and distributions

Improvements over previous

  • highlighting of constants
  • highlighting for user defined distributions
  • highlighting for truncation

Checklist

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

src/languages/stan.js Outdated Show resolved Hide resolved
end: /$/,
relevance: 0, // relevance comes from keywords
keywords: "include",
keywords: '#include',
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure this won't work without using $pattern as # isn't a normal keyword character.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's parsing as what I want:
Screen Shot 2021-11-30 at 1 45 47 PM

Feel free to make changes. I don't know javascript or regex.

Copy link
Member

Choose a reason for hiding this comment

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

You only seeing the meta highlighting... the keywords isn't working there at all because the "#" is not matched by IDENT_RE, which is what Stan uses for keyword pattern matching.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed keywords and just use the meta highlighting as I think it looks good. Let me know if this goes against the package design philosophy.

Copy link
Member

Choose a reason for hiding this comment

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

It's probably ok... I'll make a final pass and clean it up later if necessary. The relevancy may have to be tuned now, etc... but it likely looked weird before for some themes so I'm ok changing it.

src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@spinkney spinkney left a comment

Choose a reason for hiding this comment

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

hey @joshgoebel, commit "clean up grammar" broke the stan syntax highlighting for me. Nothing gets highlighted, reverting this and stan highlighting works.

Edit: It's all from line 10. I'll put that back in but feel free to update to whatever you intended

@joshgoebel
Copy link
Member

Oh line 10 is broken that's weird.

src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
src/languages/stan.js Outdated Show resolved Hide resolved
@spinkney
Copy link
Contributor Author

🎉

@joshgoebel joshgoebel merged commit 585be02 into highlightjs:main Dec 14, 2021
@rok-cesnovar
Copy link

Thanks all for the great work!

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.

Stan syntax updates
4 participants