Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
5b8a2ae1
Commit
5b8a2ae1
authored
4 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] Update ASTview to marker API changes.
parent
bf91559d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ivette/api/kernel/ast/index.ts
+36
-6
36 additions, 6 deletions
ivette/api/kernel/ast/index.ts
ivette/src/renderer/ASTview.tsx
+10
-15
10 additions, 15 deletions
ivette/src/renderer/ASTview.tsx
src/plugins/server/kernel_ast.ml
+0
-2
0 additions, 2 deletions
src/plugins/server/kernel_ast.ml
with
46 additions
and
23 deletions
ivette/api/kernel/ast/index.ts
+
36
−
6
View file @
5b8a2ae1
...
@@ -43,10 +43,6 @@ export const compute: Server.ExecRequest<null,null>= compute_internal;
...
@@ -43,10 +43,6 @@ export const compute: Server.ExecRequest<null,null>= compute_internal;
/** Marker kind */
/** Marker kind */
export
enum
markerKind
{
export
enum
markerKind
{
/** Variable */
variable
=
'
variable
'
,
/** Function */
function
=
'
function
'
,
/** Expression */
/** Expression */
expression
=
'
expression
'
,
expression
=
'
expression
'
,
/** Lvalue */
/** Lvalue */
...
@@ -83,12 +79,44 @@ const markerKindTags_internal: Server.GetRequest<null,tag[]> = {
...
@@ -83,12 +79,44 @@ const markerKindTags_internal: Server.GetRequest<null,tag[]> = {
/** Registered tags for the above type. */
/** Registered tags for the above type. */
export
const
markerKindTags
:
Server
.
GetRequest
<
null
,
tag
[]
>=
markerKindTags_internal
;
export
const
markerKindTags
:
Server
.
GetRequest
<
null
,
tag
[]
>=
markerKindTags_internal
;
/** Marker variable */
export
enum
markerVar
{
/** None */
none
=
'
none
'
,
/** Variable */
variable
=
'
variable
'
,
/** Function */
function
=
'
function
'
,
}
/** Loose decoder for `markerVar` */
export
const
jMarkerVar
:
Json
.
Loose
<
markerVar
>
=
Json
.
jEnum
(
markerVar
);
/** Safe decoder for `markerVar` */
export
const
jMarkerVarSafe
:
Json
.
Safe
<
markerVar
>
=
Json
.
jFail
(
Json
.
jEnum
(
markerVar
),
'
kernel.ast.markerVar expected
'
);
/** Natural order for `markerVar` */
export
const
byMarkerVar
:
Compare
.
Order
<
markerVar
>
=
Compare
.
byEnum
(
markerVar
);
const
markerVarTags_internal
:
Server
.
GetRequest
<
null
,
tag
[]
>
=
{
kind
:
Server
.
RqKind
.
GET
,
name
:
'
kernel.ast.markerVarTags
'
,
input
:
Json
.
jNull
,
output
:
Json
.
jList
(
jTag
),
};
/** Registered tags for the above type. */
export
const
markerVarTags
:
Server
.
GetRequest
<
null
,
tag
[]
>=
markerVarTags_internal
;
/** Data for array rows [`markerInfo`](#markerinfo) */
/** Data for array rows [`markerInfo`](#markerinfo) */
export
interface
markerInfoData
{
export
interface
markerInfoData
{
/** Entry identifier. */
/** Entry identifier. */
key
:
Json
.
key
<
'
#markerInfo
'
>
;
key
:
Json
.
key
<
'
#markerInfo
'
>
;
/** Marker kind */
/** Marker kind */
kind
:
markerKind
;
kind
:
markerKind
;
/** Marker variable */
var
:
markerVar
;
/** Marker short name */
/** Marker short name */
name
:
string
;
name
:
string
;
/** Marker declaration or description */
/** Marker declaration or description */
...
@@ -101,6 +129,7 @@ export const jMarkerInfoData: Json.Loose<markerInfoData> =
...
@@ -101,6 +129,7 @@ export const jMarkerInfoData: Json.Loose<markerInfoData> =
key
:
Json
.
jFail
(
Json
.
jKey
<
'
#markerInfo
'
>
(
'
#markerInfo
'
),
key
:
Json
.
jFail
(
Json
.
jKey
<
'
#markerInfo
'
>
(
'
#markerInfo
'
),
'
#markerInfo expected
'
),
'
#markerInfo expected
'
),
kind
:
jMarkerKindSafe
,
kind
:
jMarkerKindSafe
,
var
:
jMarkerVarSafe
,
name
:
Json
.
jFail
(
Json
.
jString
,
'
String expected
'
),
name
:
Json
.
jFail
(
Json
.
jString
,
'
String expected
'
),
descr
:
Json
.
jFail
(
Json
.
jString
,
'
String expected
'
),
descr
:
Json
.
jFail
(
Json
.
jString
,
'
String expected
'
),
});
});
...
@@ -112,10 +141,11 @@ export const jMarkerInfoDataSafe: Json.Safe<markerInfoData> =
...
@@ -112,10 +141,11 @@ export const jMarkerInfoDataSafe: Json.Safe<markerInfoData> =
/** Natural order for `markerInfoData` */
/** Natural order for `markerInfoData` */
export
const
byMarkerInfoData
:
Compare
.
Order
<
markerInfoData
>
=
export
const
byMarkerInfoData
:
Compare
.
Order
<
markerInfoData
>
=
Compare
.
byFields
Compare
.
byFields
<
{
key
:
Json
.
key
<
'
#markerInfo
'
>
,
kind
:
markerKind
,
name
:
string
,
<
{
key
:
Json
.
key
<
'
#markerInfo
'
>
,
kind
:
markerKind
,
var
:
markerVar
,
descr
:
string
}
>
({
name
:
string
,
descr
:
string
}
>
({
key
:
Compare
.
string
,
key
:
Compare
.
string
,
kind
:
byMarkerKind
,
kind
:
byMarkerKind
,
var
:
byMarkerVar
,
name
:
Compare
.
alpha
,
name
:
Compare
.
alpha
,
descr
:
Compare
.
string
,
descr
:
Compare
.
string
,
});
});
...
...
This diff is collapsed.
Click to expand it.
ivette/src/renderer/ASTview.tsx
+
10
−
15
View file @
5b8a2ae1
...
@@ -133,18 +133,8 @@ const ASTview = () => {
...
@@ -133,18 +133,8 @@ const ASTview = () => {
async
function
onContextMenu
(
id
:
key
<
'
#markerInfo
'
>
)
{
async
function
onContextMenu
(
id
:
key
<
'
#markerInfo
'
>
)
{
const
items
=
[];
const
items
=
[];
const
selectedMarkerInfo
=
markersInfo
.
find
((
e
)
=>
e
.
key
===
id
);
const
selectedMarkerInfo
=
markersInfo
.
find
((
e
)
=>
e
.
key
===
id
);
switch
(
selectedMarkerInfo
?.
kind
)
{
if
(
selectedMarkerInfo
?.
var
===
'
function
'
)
{
case
'
function
'
:
{
if
(
selectedMarkerInfo
.
kind
===
'
declaration
'
)
{
items
.
push
({
label
:
`Go to definition of
${
selectedMarkerInfo
.
name
}
`
,
onClick
:
()
=>
{
const
location
=
{
function
:
selectedMarkerInfo
.
name
};
updateSelection
({
location
});
},
});
break
;
}
case
'
declaration
'
:
{
if
(
selectedMarkerInfo
?.
name
)
{
if
(
selectedMarkerInfo
?.
name
)
{
const
locations
=
await
functionCallers
(
selectedMarkerInfo
.
name
);
const
locations
=
await
functionCallers
(
selectedMarkerInfo
.
name
);
const
locationsByFunction
=
_
.
groupBy
(
locations
,
(
e
)
=>
e
.
function
);
const
locationsByFunction
=
_
.
groupBy
(
locations
,
(
e
)
=>
e
.
function
);
...
@@ -162,10 +152,15 @@ const ASTview = () => {
...
@@ -162,10 +152,15 @@ const ASTview = () => {
});
});
});
});
}
}
break
;
}
else
{
items
.
push
({
label
:
`Go to definition of
${
selectedMarkerInfo
.
name
}
`
,
onClick
:
()
=>
{
const
location
=
{
function
:
selectedMarkerInfo
.
name
};
updateSelection
({
location
});
},
});
}
}
default
:
break
;
}
}
if
(
items
.
length
>
0
)
if
(
items
.
length
>
0
)
Dome
.
popupMenu
(
items
);
Dome
.
popupMenu
(
items
);
...
...
This diff is collapsed.
Click to expand it.
src/plugins/server/kernel_ast.ml
+
0
−
2
View file @
5b8a2ae1
...
@@ -52,8 +52,6 @@ module MarkerKind = struct
...
@@ -52,8 +52,6 @@ module MarkerKind = struct
~
descr
:
(
Md
.
plain
(
String
.
capitalize_ascii
name
))
~
descr
:
(
Md
.
plain
(
String
.
capitalize_ascii
name
))
kinds
kinds
let
var
=
kind
"variable"
let
fct
=
kind
"function"
let
expr
=
kind
"expression"
let
expr
=
kind
"expression"
let
lval
=
kind
"lvalue"
let
lval
=
kind
"lvalue"
let
decl
=
kind
"declaration"
let
decl
=
kind
"declaration"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment