Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
273dfdc1
Commit
273dfdc1
authored
Dec 08, 2016
by
Kim Nguyen
Browse files
[trywhy3] Fix syntax highlighting of comments:
* Nested comments are supported * Add a special exception for the (*) token
parent
bff9ba1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/trywhy3/mode-why3.js
View file @
273dfdc1
...
...
@@ -40,14 +40,28 @@ var Why3HighlightRules = function() {
this
.
$rules
=
{
"
start
"
:
[
{
token
:
"
comment
"
,
regex
:
'
\\
(
\\
*.*?
\\
*
\\
)
\\
s*?$
'
{
token
:
[
"
paren.lparen
"
,
"
text
"
,
"
paren.rparen
"
],
regex
:
"
([(])([*])([)])
"
},
{
token
:
"
comment
"
,
regex
:
'
\\
(
\\
*.*
'
,
next
:
"
comment
"
{
//black magic from Rust mode to handle nested comments.
token
:
"
comment.start
"
,
regex
:
"
\\
(
\\
*
"
,
stateName
:
"
comment
"
,
push
:
[
{
token
:
'
comment.start
'
,
regex
:
"
\\
(
\\
*
"
,
push
:
'
comment
'
},
{
token
:
'
comment.end
'
,
regex
:
"
\\
*
\\
)
"
,
next
:
'
pop
'
},
{
defaultToken
:
'
comment
'
}
]
},
{
token
:
"
string
"
,
// single line
...
...
@@ -95,18 +109,6 @@ var Why3HighlightRules = function() {
regex
:
"
\\
s+
"
}
],
"
comment
"
:
[
{
token
:
"
comment
"
,
// closing comment
regex
:
"
.*?
\\
*
\\
)
"
,
next
:
"
start
"
},
{
token
:
"
comment
"
,
// comment spanning whole line
regex
:
"
.+
"
}
],
"
qstring
"
:
[
{
token
:
"
string
"
,
...
...
@@ -114,10 +116,12 @@ var Why3HighlightRules = function() {
next
:
"
start
"
},
{
token
:
"
string
"
,
regex
:
'
.+
'
regex
:
'
[^"]
'
}
]
};
this
.
normalizeRules
();
};
oop
.
inherits
(
Why3HighlightRules
,
TextHighlightRules
);
...
...
@@ -225,7 +229,7 @@ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
this
.
autoOutdent
=
function
(
state
,
doc
,
row
)
{
this
.
$outdent
.
autoOutdent
(
doc
,
row
);
};
this
.
blockComment
=
{
start
:
"
(*
"
,
end
:
"
*)
"
,
nestable
:
true
};
this
.
$id
=
"
ace/mode/why3
"
;
}).
call
(
Mode
.
prototype
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment