Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ubiquity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cip
ubiquity
Merge requests
!268
Resolve "Plugin langage Prolog"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Plugin langage Prolog"
243-plugin-langage-prolog
into
pre-prod
Overview
0
Commits
7
Pipelines
3
Changes
3
Merged
Resolve "Plugin langage Prolog"
Houchard Julien
requested to merge
243-plugin-langage-prolog
into
pre-prod
Apr 17, 2023
Overview
0
Commits
7
Pipelines
3
Changes
3
Closes
#243 (closed)
Ajout du plugin de langage Prolog
0
0
Merge request reports
Compare
pre-prod
version 2
de440ff8
Apr 17, 2023
version 1
672b818b
Apr 17, 2023
pre-prod (base)
and
latest version
latest version
2995b621
7 commits,
Apr 17, 2023
version 2
de440ff8
6 commits,
Apr 17, 2023
version 1
672b818b
5 commits,
Apr 17, 2023
3 files
+
69
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
ubiquity/tutoring/models/languages/plugins/prolog.py
0 → 100644
+
49
−
0
View file @ 2995b621
Edit in single-file editor
Open in Web IDE
"""
Module prolog language
"""
# ubiquity
# Copyright (C) 2023 INSA Rouen Normandie - CIP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from
typing
import
List
,
Tuple
,
Optional
from
..language_base
import
Language
from
..lexicon
import
Lexicon
,
Token
class
PrologLanguage
(
Language
):
"""
A prolog language plugin
"""
@property
def
file_name
(
self
)
->
str
:
return
r
'
.+\.pl$
'
@property
def
comments
(
self
)
->
List
[
Tuple
[
Optional
[
str
],
Optional
[
str
]]]:
return
[(
'
%
'
,
None
),
(
'
/*
'
,
'
*/
'
)]
@property
def
prettify_lang
(
self
)
->
str
:
return
'
prolog
'
@property
def
lexicon
(
self
)
->
Lexicon
:
return
Lexicon
({
Token
.
DELIMITER
:
r
"
[\+\-\*\\\/\^<>=~:\.\?#&@]+
"
,
Token
.
AFFECTATION
:
r
"
=|(\:\-)
"
,
Token
.
OPERATOR
:
"
|
"
.
join
(
(
r
"
==
"
,
r
"
=:=
"
,
r
"
\\==
"
,
r
"
=\\=
"
,
r
"
\+
"
,
r
"
-
"
,
r
"
\*
"
,
r
"
/
"
,
r
"
//
"
,
r
"
>
"
,
r
"
<
"
,
r
"
>=
"
,
r
"
=<
"
,
r
"
=\.\.
"
,
r
"
\.\.\.
"
)),
Token
.
COMMENT
:
r
"
(%.*)|(/\*(.|\s)*?\*/)
"
,
Token
.
STR
:
r
"'
(([^
'
])|(
''
))*
'"
,
Token
.
KEYWORD
:
r
"
(
"
+
"
|
"
.
join
([
r
'
is
'
,
r
'
not
'
])
+
r
"
)[\W$]
"
})
Loading