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
6d476c7c
Commit
6d476c7c
authored
Apr 06, 2010
by
Jean-Christophe Filliâtre
Browse files
IDE : un peu de coloration syntaxique
parent
a493d3a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
share/lang/why.lang
0 → 100644
View file @
6d476c7c
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language
_name=
"Objective Caml"
version=
"1.0"
_section=
"Sources"
mimetypes=
"text/x-ocaml"
>
<escape-char>
\
</escape-char>
<block-comment
_name =
"Comment"
style=
"Comment"
end-at-line-end =
"FALSE"
>
<start-regex>
\(\*[^)]
</start-regex>
<end-regex>
\*\)
</end-regex>
</block-comment>
<pattern-item
_name =
"Decimal"
style =
"Decimal"
>
<regex>
\b[-]?[0-9][0-9_]*[lL]?\b
</regex>
</pattern-item>
<pattern-item
_name =
"Hex Number"
style =
"Base-N Integer"
>
<regex>
\b[-]?0[xX][0-9A-Fa-f][0-9A-Fa-f_]*[lL]?\b
</regex>
</pattern-item>
<pattern-item
_name =
"Octal Number"
style =
"Base-N Integer"
>
<regex>
\b[-]?0[oO][0-7][0-7_]*[lL]?\b
</regex>
</pattern-item>
<pattern-item
_name =
"Binary Number"
style =
"Base-N Integer"
>
<regex>
\b[-]?0[bB][01][01_]*[lL]?\b
</regex>
</pattern-item>
<pattern-item
_name =
"Floating Point Number"
style =
"Floating Point"
>
<regex>
\b[-]?[0-9][0-9_]*(\.[0-9_]*)?([Ee][+-]?[0-9][0-9_]*)?
</regex>
</pattern-item>
<string
_name =
"Character Constant"
style =
"String"
end-at-line-end =
"TRUE"
>
<start-regex>
'
</start-regex>
<end-regex>
'
</end-regex>
</string>
<string
_name =
"String"
style =
"String"
end-at-line-end =
"FALSE"
>
<start-regex>
"
</start-regex>
<end-regex>
"
</end-regex>
</string>
<pattern-item
_name =
"Modules"
style =
"Data Type"
case-sensitive=
"TRUE"
>
<regex>
\b[A-Z][A-Za-z0-9_']*
</regex>
</pattern-item>
<keyword-list
_name =
"Definition keyword"
style =
"Keyword"
case-sensitive=
"TRUE"
>
<keyword>
theory
</keyword>
<keyword>
end
</keyword>
<keyword>
use
</keyword>
<keyword>
clone
</keyword>
<keyword>
namespace
</keyword>
<keyword>
import
</keyword>
<keyword>
export
</keyword>
<keyword>
inductive
</keyword>
<keyword>
logic
</keyword>
<keyword>
axiom
</keyword>
<keyword>
lemma
</keyword>
<keyword>
goal
</keyword>
<keyword>
type
</keyword>
</keyword-list>
<keyword-list
_name =
"Expression keyword"
style =
"Keyword"
case-sensitive=
"TRUE"
>
<keyword>
match
</keyword>
<keyword>
let
</keyword>
<keyword>
in
</keyword>
<keyword>
if
</keyword>
<keyword>
then
</keyword>
<keyword>
else
</keyword>
</keyword-list>
<keyword-list
_name =
"Types"
style =
"Data Type"
case-sensitive=
"TRUE"
>
<keyword>
int
</keyword>
<keyword>
real
</keyword>
</keyword-list>
</language>
src/ide/ide_main.ml
View file @
6d476c7c
...
...
@@ -44,6 +44,19 @@ let fname = match !file with
|
Some
f
->
f
let
lang
=
let
file
=
List
.
fold_right
Filename
.
concat
[
Filename
.
dirname
Sys
.
argv
.
(
0
);
".."
;
"share"
;
"lang"
]
"why.lang"
in
if
Sys
.
file_exists
file
then
let
languages_manager
=
GSourceView
.
source_languages_manager
()
in
GSourceView
.
source_language_from_file
~
languages_manager
file
else
begin
Format
.
eprintf
"could not find lang file (%S)@."
;
None
end
let
text
=
let
ic
=
open_in
fname
in
let
size
=
in_channel_length
ic
in
...
...
@@ -170,6 +183,11 @@ let main () =
()
in
source_view
#
misc
#
modify_font_by_name
font_name
;
begin
match
lang
with
|
Some
lang
->
source_view
#
source_buffer
#
set_language
lang
|
None
->
()
end
;
source_view
#
source_buffer
#
set_highlight
true
;
source_view
#
source_buffer
#
set_text
text
;
w
#
add_accel_group
accel_group
;
...
...
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