From fb071e2bfd065f70de7785b3c063664c9954270a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr> Date: Fri, 6 Mar 2020 15:37:29 +0100 Subject: [PATCH] [ivette] introduce AST view --- ivette/src/renderer/ASTview.js | 41 ++++++++++++++++++++++++++++++ ivette/src/renderer/Application.js | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 ivette/src/renderer/ASTview.js diff --git a/ivette/src/renderer/ASTview.js b/ivette/src/renderer/ASTview.js new file mode 100644 index 00000000000..ae39f1c8c5a --- /dev/null +++ b/ivette/src/renderer/ASTview.js @@ -0,0 +1,41 @@ +// -------------------------------------------------------------------------- +// --- AST Source Code +// -------------------------------------------------------------------------- + +import _ from 'lodash' ; +import React from 'react' ; +import Dome from 'dome' ; +import States from 'frama-c/states' ; +import { Component } from 'frama-c/labviews' ; + +// -------------------------------------------------------------------------- +// --- AST Printer +// -------------------------------------------------------------------------- + +const ASTview = () => { + + // Hooks + const [ select, setSelect ] = States.useSelection(); + + return ( + <div> + <div>Function: {select && select.function}</div> + <div>Marker: {select && select.marker}</div> + </div> + ); +}; + +// -------------------------------------------------------------------------- +// --- Export Component +// -------------------------------------------------------------------------- + +export default () => ( + <Component id='frama-c.astview' + label='AST' + title='Normalized source code representation.' + > + <ASTview/> + </Component> +); + +// -------------------------------------------------------------------------- diff --git a/ivette/src/renderer/Application.js b/ivette/src/renderer/Application.js index dc02e42e700..684da31a04f 100644 --- a/ivette/src/renderer/Application.js +++ b/ivette/src/renderer/Application.js @@ -17,6 +17,7 @@ import { LabView, View, Group, Component } from 'frama-c/labviews' ; import { GridItem, GridHbox, GridVbox } from 'dome/layout/grids'; import Controller from './Controller' ; import Properties from './Properties' ; +import ASTview from './ASTview' ; // -------------------------------------------------------------------------- // --- Main View @@ -56,8 +57,8 @@ export default (function() { </View> <Group id='frama-c' label='Frama-C' title='Frama-C Kernel Components'> <Controller.Console/> - <Properties.PropTable/> <Properties/> + <ASTview/> </Group> </LabView> </Splitter> -- GitLab