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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates operator regex
fedonman committed Mar 17, 2021
commit 771a6523f40b01b650cef2a0614f58b5be2ca11e
24 changes: 7 additions & 17 deletions components/prism-qsharp.js
Original file line number Diff line number Diff line change
@@ -124,9 +124,7 @@

// string interpolation
var formatString = /:[^}\r\n]+/.source;
// multi line
var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2)
var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);

// single line
var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2)
var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
@@ -157,20 +155,12 @@
}

Prism.languages.insertBefore('qsharp', 'string', {
'interpolation-string': [
{
pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
lookbehind: true,
greedy: true,
inside: createInterpolationInside(mInterpolation, mInterpolationRound),
},
{
pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
lookbehind: true,
greedy: true,
inside: createInterpolationInside(sInterpolation, sInterpolationRound),
}
]
'interpolation-string': {
pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
lookbehind: true,
greedy: true,
inside: createInterpolationInside(sInterpolation, sInterpolationRound),
}
});

}(Prism));