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

Αdding support for Q# language #2804

Merged
merged 21 commits into from
Mar 23, 2021
Merged

Conversation

fedonman
Copy link
Contributor

This is more like a stripped version of C# with some minor modifications to match Q# style. Code highlighting is pretty good so far, although some improvements are already identified (like special functions, and integration with C# / Python host programs)

@github-actions
Copy link

github-actions bot commented Mar 15, 2021

JS File Size Changes (gzipped)

A total of 3 files have changed, with a combined diff of +1.02 KB (+22.7%).

file master pull size diff % diff
components/prism-qsharp.min.js 0 Bytes 1.01 KB +1.01 KB +100.0%
plugins/autoloader/prism-autoloader.min.js 2.2 KB 2.21 KB +9 B +0.4%
plugins/show-language/prism-show-language.min.js 2.31 KB 2.32 KB +8 B +0.3%

Generated by 🚫 dangerJS against d0d2f07

@RunDevelopment
Copy link
Member

Thank you for the PR @fedonman!

Right now, your Q# is still too C#-like (e.g. Q# doesn't have verbatim strings or multiline comments). There are also a few missing keywords and operators.

Fortunately, Microsoft provides a full ANTRL4 grammar for Q#, so missing keywords and operators shouldn't be a problem. This grammar is extremely useful, so I recommend using it (it has the answer to literally all questions regarding Q# syntax).

And please add more tests. Q# is a simple language compared to C# but it is not trivial, so please test keywords, operators, and the class-name patterns you added.

@fedonman
Copy link
Contributor Author

fedonman commented Mar 17, 2021

Thank you for the grammar link! It really helps.

I have:

  • modified keywords list
  • modified regex expressions for numbers, operators and punctuation
  • removed multiline comments / strings
  • removed verbatim strings
  • added 3 more test cases

components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

I think this will be the last round.

components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Last review round, I think.

Please take a look at my comments and resolve the merge conflicts.

components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
components/prism-qsharp.js Outdated Show resolved Hide resolved
fedonman and others added 3 commits March 23, 2021 08:35
@RunDevelopment RunDevelopment merged commit 1b63cd0 into PrismJS:master Mar 23, 2021
@RunDevelopment
Copy link
Member

Thank you for contributing @fedonman!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants