Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ACGtk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ACG
dev
ACGtk
Commits
4e9d4711
Commit
4e9d4711
authored
Oct 05, 2018
by
POGODALLA Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Answers to feature request
#7
parent
235d5742
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
8 deletions
+13
-8
src/acg-data/acg_lexicon.ml
src/acg-data/acg_lexicon.ml
+2
-2
src/acg-data/interface.ml
src/acg-data/interface.ml
+1
-0
src/acg-data/interface.mli
src/acg-data/interface.mli
+4
-0
src/scripting/functions.ml
src/scripting/functions.ml
+6
-6
No files found.
src/acg-data/acg_lexicon.ml
View file @
4e9d4711
...
...
@@ -291,9 +291,7 @@ struct
|
None
,_
->
let
()
=
Logs
.
warn
(
fun
m
->
m
"Parsing is not implemented for non 2nd order ACG."
)
in
SharedForest
.
SharedForest
.
empty
(* | Some (prog,_), (Lambda.Atom _ as dist_type) -> *)
|
Some
{
prog
}
,
(
Lambda
.
Atom
_
as
dist_type
)
->
(* let pre_parse_time = Sys.time () in *)
Log
.
info
(
fun
m
->
m
"Before parsing. Program is currently:"
);
DatalogAbstractSyntax
.
Program
.
log_content
Logs
.
Info
(
Datalog
.
Program
.
to_abstract
prog
)
;
Log
.
info
(
fun
m
->
m
"That's all."
);
...
...
@@ -359,6 +357,8 @@ struct
t
)
,
resume
let
is_empty
=
SharedForest
.
SharedForest
.
is_empty
let
to_string
({
name
=
n
,_;
dico
=
d
;
abstract_sig
=
abs_sg
;
object_sig
=
obj_sg
}
as
lex
)
=
let
buff
=
Buffer
.
create
80
in
let
()
=
Printf
.
bprintf
...
...
src/acg-data/interface.ml
View file @
4e9d4711
...
...
@@ -107,6 +107,7 @@ sig
val
check
:
t
->
unit
val
parse
:
Signature
.
term
->
Signature
.
stype
->
t
->
resume
val
get_analysis
:
resume
->
t
->
Lambda
.
term
option
*
resume
val
is_empty
:
resume
->
bool
val
compose
:
t
->
t
->
(
string
*
Abstract_syntax
.
location
)
->
t
val
program_to_buffer
:
t
->
Buffer
.
t
val
program_to_log
:
Logs
.
src
->
Logs
.
level
->
t
->
unit
...
...
src/acg-data/interface.mli
View file @
4e9d4711
...
...
@@ -277,6 +277,10 @@ module type Lexicon_sig =
[(Some t,r')] where [t] is another solution, and [r'] a new
resumption. Otherwise it returns [(None,r')].*)
val
get_analysis
:
resume
->
t
->
Lambda
.
term
option
*
resume
(** [is_empty r] tells whether there is another solution to look in
the resumption *)
val
is_empty
:
resume
->
bool
(** [compose l2 l1 (name,loc)] returns a new lexicon which is the
composition of [l2] and [l1 ] ([l2] after [l1]) such that the
...
...
src/scripting/functions.ml
View file @
4e9d4711
...
...
@@ -651,14 +651,15 @@ module Functions =
let
rec
ask_for_next_parse
f
param
=
let
rec
no_interaction
f
p
=
match
f
p
with
|
None
->
Logs
.
app
(
fun
m
->
m
"No other
possible value
"
)
|
None
->
Logs
.
app
(
fun
m
->
m
"No other
solution
"
)
|
Some
new_param
->
no_interaction
f
new_param
in
let
msg
=
Printf
.
sprintf
"Do you want to look for another solution?
\n\t
y/yes
\n\t
n/no
\n\t
a/all
\n
(Default: yes):"
in
match
interact
msg
return_input
with
|
Next
->
(
match
f
param
with
|
None
->
Logs
.
app
(
fun
m
->
m
"No other possible value"
)
|
Some
new_param
->
ask_for_next_parse
f
new_param
)
|
None
->
Logs
.
app
(
fun
m
->
m
"No other solution"
)
|
Some
new_param
when
Env
.
Lexicon
.
is_empty
new_param
->
Logs
.
app
(
fun
m
->
m
"No other solution"
)
|
Some
new_param
->
ask_for_next_parse
f
new_param
)
|
All
->
no_interaction
f
param
|
Stop
->
()
...
...
@@ -681,15 +682,14 @@ module Functions =
let
parse
?
name
e
data
l
=
let
lex
=
get_lex
name
"parse"
e
l
in
(* let abs,_=Env.Lexicon.get_sig lex in *)
match
Data_parser
.
parse_heterogenous_term
~
output
:
false
data
lex
with
|
None
->
()
|
Some
(
obj_t
,
abs_ty
)
->
let
resume
=
get_parse_tree
(
Env
.
Lexicon
.
parse
obj_t
abs_ty
lex
)
abs_ty
lex
in
match
resume
with
|
None
->
Logs
.
app
(
fun
m
->
m
"No solution."
)
|
Some
resume
->
ask_for_next_parse
(
fun
res
->
get_parse_tree
res
abs_ty
lex
)
resume
|
Some
resume
when
Env
.
Lexicon
.
is_empty
resume
->
Logs
.
app
(
fun
m
->
m
"No other solution."
)
|
Some
resume
->
ask_for_next_parse
(
fun
res
->
get_parse_tree
res
abs_ty
lex
)
resume
let
idb
?
name
e
l
=
...
...
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