mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 16:28:12 +03:00
Localized files extensions, syntax highlighting for non-verbose which is now the defaul
This commit is contained in:
parent
c97f9f4104
commit
e54bce094c
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -9,3 +9,9 @@
|
||||
url = https://github.com/pygments/pygments.git
|
||||
branch = master
|
||||
ignore = dirty
|
||||
|
||||
[submodule "syntax_highlighting/nv/pygments/pygments"]
|
||||
path = syntax_highlighting/nv/pygments/pygments
|
||||
url = https://github.com/pygments/pygments.git
|
||||
branch = master
|
||||
ignore = dirty
|
||||
|
6
Makefile
6
Makefile
@ -76,7 +76,11 @@ atom_en: ${CURDIR}/syntax_highlighting/en/setup_atom.sh
|
||||
chmod +x $<
|
||||
$<
|
||||
|
||||
atom: atom_fr atom_en
|
||||
atom_nv: ${CURDIR}/syntax_highlighting/nv/setup_atom.sh
|
||||
chmod +x $<
|
||||
$<
|
||||
|
||||
atom: atom_fr atom_en atom_nv
|
||||
|
||||
##########################################
|
||||
# Examples-related rules
|
||||
|
@ -7,9 +7,7 @@ LATEXMK=latexmk
|
||||
PYGMENTIZE_FR=../../syntax_highlighting/fr/pygments/pygments/env/bin/pygmentize
|
||||
PYGMENTIZE_EN=../../syntax_highlighting/en/pygments/pygments/env/bin/pygmentize
|
||||
|
||||
CATALA_LANG?=fr
|
||||
|
||||
CATALA=dune exec ../../src/catala.exe -- --debug --language=$(CATALA_LANG)
|
||||
CATALA=dune exec --no-print-director ../../src/catala.exe -- --debug --language=$(CATALA_LANG)
|
||||
|
||||
LEGIFRANCE_CATALA=dune exec ../../src/legifrance_catala.exe --
|
||||
|
||||
@ -30,7 +28,7 @@ endif
|
||||
# Targets
|
||||
##########################################
|
||||
|
||||
%.tex: %.catala $(CATALA_EXE)
|
||||
%.tex: %.catala_$(CATALA_LANG) $(CATALA_EXE)
|
||||
$(CATALA) Makefile $<
|
||||
$(CATALA) \
|
||||
--wrap \
|
||||
@ -38,7 +36,7 @@ endif
|
||||
LaTeX \
|
||||
$<
|
||||
|
||||
%.html: %.catala $(CATALA_EXE)
|
||||
%.html: %.catala_$(CATALA_LANG) $(CATALA_EXE)
|
||||
$(CATALA) Makefile $<
|
||||
$(CATALA) \
|
||||
--wrap \
|
||||
@ -46,7 +44,7 @@ endif
|
||||
HTML \
|
||||
$<
|
||||
|
||||
%.expired: %.catala $(CATALA_EXE) $(LEGIFRANCE_CATALA_EXE)
|
||||
%.expired: %.catala_$(CATALA_LANG) $(CATALA_EXE) $(LEGIFRANCE_CATALA_EXE)
|
||||
$(LEGIFRANCE_CATALA) $< $(CLIENT_ID) $(CLIENT_SECRET)
|
||||
|
||||
%.pdf: %.tex
|
||||
@ -57,9 +55,9 @@ endif
|
||||
##########################################
|
||||
|
||||
clean:
|
||||
$(LATEXMK) -f -C $(SRC:.catala=.tex)
|
||||
rm -rf $(SRC:.catala=.tex) $(SRC:.catala=.d) _minted-$(SRC:.catala=)
|
||||
$(LATEXMK) -f -C $(SRC:.catala_$(CATALA_LANG)=.tex)
|
||||
rm -rf $(SRC:.catala_$(CATALA_LANG)=.tex) $(SRC:.catala_$(CATALA_LANG)=.d) _minted-$(SRC:.catala_$(CATALA_LANG)=)
|
||||
|
||||
include $(wildcard $(SRC:.catala=.d))
|
||||
include $(wildcard $(SRC:.catala_$(CATALA_LANG)=.d))
|
||||
|
||||
.SECONDARY:
|
||||
|
@ -1,3 +1,4 @@
|
||||
SRC=allocations_familiales.catala
|
||||
CATALA_LANG=fr
|
||||
SRC=allocations_familiales.catala_fr
|
||||
|
||||
include ../Makefile.common
|
||||
|
@ -1,207 +0,0 @@
|
||||
/*
|
||||
# Some headers to define useful structures
|
||||
|
||||
struct Enfant extends Personne {
|
||||
int age,
|
||||
date fin_obligation_scolaire,
|
||||
montant rémunération
|
||||
}
|
||||
|
||||
struct Ménage {
|
||||
vec<Enfant> enfants,
|
||||
opt<Enfant> enfant_plus_âgé,
|
||||
montant ressources
|
||||
}
|
||||
|
||||
struct L512_3_Data {
|
||||
int age_limite_alinéa_2,
|
||||
montant plafond_remuneration_alinéa_2,
|
||||
bool droits_ouverts_prestations_familiales,
|
||||
int age_limite_alternatif,
|
||||
bool age_limite_alt_appliqué
|
||||
}
|
||||
|
||||
struct L521_1_Data {
|
||||
montant allocations_familiales,
|
||||
montant allocation_forfaitaire,
|
||||
bool allocation_forfaitaire_versée,
|
||||
int nombre_minimum_enfant
|
||||
}
|
||||
|
||||
struct L521_3_Data {
|
||||
int âge_limite_alinéa_2 wrt Enfant,
|
||||
montant minimum_alinéa_2,
|
||||
bool droits_ouverts_majorations_allocations_familiales,
|
||||
montant majorations_allocations_familiales
|
||||
}
|
||||
|
||||
rule_context PrestationFamiliale (ménage : Ménage, l512_3 : L512_3_Data) {
|
||||
}
|
||||
|
||||
struct MénageAllocationsFamiliales extends Ménage {
|
||||
int nb_enfants_majoration,
|
||||
montant majorations_versées
|
||||
}
|
||||
|
||||
rule_context AllocationsFamiliales (
|
||||
ménage : MénageAllocationsFamiliales,
|
||||
l521_1 : L521_1_Data,
|
||||
l521_3 : L521_3_Data
|
||||
)
|
||||
{
|
||||
include_rule_context PrestationsFamiliales(ménage);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@Article L512-3
|
||||
Sous réserve des règles particulières à chaque prestation, ouvre droit aux prestations familiales :
|
||||
1°) tout enfant jusqu'à la fin de l'obligation scolaire ;
|
||||
|
||||
/*
|
||||
rule_context PrestationsFamiliales {
|
||||
rule l512_3.droits_ouverts_prestations_familiales =
|
||||
exists enfant in ménage.enfants st
|
||||
Date.today < enfant.fin_obligation_scolaire;
|
||||
}
|
||||
*/
|
||||
|
||||
2°) après la fin de l'obligation scolaire, et jusqu'à un âge limite, tout enfant dont la rémunération éventuelle n'excède pas un plafond.
|
||||
|
||||
/*
|
||||
|
||||
rule_context PrestationsFamiliales {
|
||||
rule l512_3.droits_ouverts_prestations_familiales =
|
||||
exists enfant in ménage.enfants st
|
||||
Date.today > enfant.fin_obligation_scolaire &&
|
||||
enfant.age < L512_3.age_limite &&
|
||||
enfant.remuneration < L512_3.plafond_remuneration;
|
||||
}
|
||||
*/
|
||||
|
||||
Toutefois, pour l'attribution du complément familial et de l'allocation de logement mentionnés aux 3° et 4° de l'article L. 511-1, l'âge limite peut être différent de celui mentionné au 2° du présent article.
|
||||
|
||||
/*
|
||||
|
||||
# On a pas défini ce l'énum prestation ici
|
||||
|
||||
rule_context PrestationsFamiliales (L512_3: L_512_3_Data) (famille: FamillePrestationsFamiliales) {
|
||||
rule if (L512_3.age_limite_alt_appliqué && (famille.prestation = ComplémentFamilial || famille.prestation = AllocationLogement))
|
||||
then age_limite = age_limite_alternatif;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@Article L521_1
|
||||
|
||||
Les allocations familiales sont dues à partir du deuxième enfant à charge.
|
||||
|
||||
/*
|
||||
struct FamilleAllocationsFamiliales extends FamillePrestationsFamiliales {}
|
||||
|
||||
rule_context AllocationsFamiliales {
|
||||
assert (len(famille.enfants) >= 2)
|
||||
}
|
||||
*/
|
||||
|
||||
Une allocation forfaitaire par enfant d'un montant fixé par décret est versée pendant un an à la personne ou au ménage qui assume la charge d'un nombre minimum d'enfants également fixé par décret lorsque l'un ou plusieurs des enfants qui ouvraient droit aux allocations familiales atteignent l'âge limite mentionné au 2° de l'article L. 512-3. Cette allocation est versée à la condition que le ou les enfants répondent aux conditions autres que celles de l'âge pour l'ouverture du droit aux allocations familiales.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
assert l512_1.allocation_forfaitaire fixé par décret;
|
||||
assert l521_1.nombre_minimum_enfants fixé par décret;
|
||||
rule l521.allocation_forfaitaire_versée =
|
||||
exists enfant in ménage.enfant st
|
||||
enfant.age = l512_3.âge_limite_alinéa_2 &&
|
||||
enfant.ok;
|
||||
}
|
||||
*/
|
||||
|
||||
Le montant des allocations mentionnées aux deux premiers alinéas du présent article, ainsi que celui des majorations mentionnées à l'article L. 521-3 varient en fonction des ressources du ménage ou de la personne qui à la charge des enfants, selon un barème défini par décret.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
assert l512_1.allocations_familiales fixé par décret;
|
||||
assert l512_1.allocations_familiales varie avec ménage.ressources;
|
||||
assert l521_3.majorations_allocations_familiales fixé par décret;
|
||||
assert l521_3.majorations_allocations_familiales varie avec ménage.ressources;
|
||||
}
|
||||
*/
|
||||
|
||||
Le montant des allocations familiales varie en fonction du nombre d'enfants à charge.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
assert l512_1.allocations_familiales varie avec len(ménage.enfants);
|
||||
}
|
||||
*/
|
||||
|
||||
Les niveaux des plafonds de ressources, qui varient en fonction du nombre d'enfants à charge, sont révisés conformément à l'évolution annuelle de l'indice des prix à la consommation, hors tabac.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
# Pas formalisé ici
|
||||
}
|
||||
*/
|
||||
|
||||
Un complément dégressif est versé lorsque les ressources du bénéficiaire dépassent l'un des plafonds, dans la limite de montants définis par décret. Les modélités de calcul de ces montants et celles du complément dégressif sont définies par décret.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
# TODO
|
||||
}
|
||||
*/
|
||||
|
||||
@Article L521_3
|
||||
Chacun des enfants à charge, à l'exception du plus âgé, ouvre droit à partir d'un âge minimum à une majoration des allocations familiales.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
ménage.nb_enfants_majoration =
|
||||
count enfant in ménage.enfants st
|
||||
enfant != ménage.enfant_plus_âgé &&
|
||||
enfant.âge >= l521_3.âge_limite_alinéa_1(enfant);
|
||||
}
|
||||
*/
|
||||
|
||||
Toutefois, les personnes ayant un nombre déterminé d'enfants à charge bénéficient de ladite majoration pour chaque enfant à charge à partir de l'âge mentionné au premier alinéa.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
rule if len(ménage.enfants) >= l512.minimum_alinéa_2) then
|
||||
ménage.nb_enfants_majoration =
|
||||
count enfant in ménage.enfants st
|
||||
enfant.âge >= l521_3.minimum_alinéa_2;
|
||||
|
||||
# Est-ce que cette règle est spécifiée quelque part ou doit on la sortir de notre chapeau ?
|
||||
rule ménage.majorations_versées = ménage.nb_enfants_majoration * l521_3.majorations_allocations_familiales;
|
||||
}
|
||||
*/
|
||||
|
||||
@Article R521-1
|
||||
|
||||
L'âge mentionné au premier alinéa de l'article L. 521-3 à partir duquel les enfants ouvrent droit à la majoration des allocations familiales est fixé à 14 ans.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
rule l521_3.âge_limite_alinéa_1(enfant) = 14 ans;
|
||||
}
|
||||
*/
|
||||
|
||||
Le nombre d'enfants à charge, mentionné au deuxième alinéa de l'article L. 521-3 ouvrant droit à ladite majoration pour chaque enfant est fixé à trois.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
rule l521_3.minimum_alinéa_2 = 3;
|
||||
}
|
||||
*/
|
||||
|
||||
NOTA : Décret n°2008-409 du 28 avril 2008 JORF du 29 avril 2008 art. 2 : Les modification induites par le décret n°2008-409 s'appliquent aux enfants dont le onzième anniversaire est postérieur au 30 avril 2008.
|
||||
|
||||
/*
|
||||
rule_context AllocationsFamiliales {
|
||||
rule l521_3.âge_limite_alinéa_1(enfant) =
|
||||
if (enfant.date_naissance + 11 an > 30/04/2008) then 16 ans.
|
||||
}
|
||||
*/
|
||||
|
@ -1,11 +0,0 @@
|
||||
@@Fichier maître@@
|
||||
|
||||
@@Inclusion: metadata.catala@@
|
||||
|
||||
@@Inclusion: securite_sociale_L.catala@@
|
||||
|
||||
@@Inclusion: securite_sociale_R.catala@@
|
||||
|
||||
@@Inclusion: securite_sociale_D.catala@@
|
||||
|
||||
@@Inclusion: decrets_divers.catala@@
|
@ -0,0 +1,11 @@
|
||||
@@Fichier maître@@
|
||||
|
||||
@@Inclusion: metadata.catala_fr@@
|
||||
|
||||
@@Inclusion: securite_sociale_L.catala_fr@@
|
||||
|
||||
@@Inclusion: securite_sociale_R.catala_fr@@
|
||||
|
||||
@@Inclusion: securite_sociale_D.catala_fr@@
|
||||
|
||||
@@Inclusion: decrets_divers.catala_fr@@
|
@ -1,4 +1,4 @@
|
||||
CATALA_LANG=fr
|
||||
SRC=code_general_impots.catala
|
||||
SRC=code_general_impots.catala_fr
|
||||
|
||||
include ../Makefile.common
|
||||
|
@ -1,3 +0,0 @@
|
||||
@@Fichier maître@@
|
||||
|
||||
@@Inclusion: Section_I_Dispositions_generales.catala@@
|
@ -0,0 +1,3 @@
|
||||
@@Fichier maître@@
|
||||
|
||||
@@Inclusion: Section_I_Dispositions_generales.catala_fr@@
|
@ -1,4 +1,4 @@
|
||||
CATALA_LANG=en
|
||||
SRC=tutorial_en.catala
|
||||
SRC=tutorial_en.catala_en
|
||||
|
||||
include ../Makefile.common
|
||||
|
@ -1,4 +1,4 @@
|
||||
CATALA_LANG=en
|
||||
SRC=us_tax_code.catala
|
||||
SRC=us_tax_code.catala_en
|
||||
|
||||
include ../Makefile.common
|
||||
|
@ -1,7 +0,0 @@
|
||||
@@Master file@@
|
||||
|
||||
@@Include: preamble.catala@@
|
||||
|
||||
@@Include: section_132.catala@@
|
||||
|
||||
@@Include: section_1015.catala@@
|
7
examples/us_tax_code/us_tax_code.catala_en
Normal file
7
examples/us_tax_code/us_tax_code.catala_en
Normal file
@ -0,0 +1,7 @@
|
||||
@@Master file@@
|
||||
|
||||
@@Include: preamble.catala_en@@
|
||||
|
||||
@@Include: section_132.catala_en@@
|
||||
|
||||
@@Include: section_1015.catala_en@@
|
@ -20,9 +20,6 @@ let driver (source_file : string) (debug : bool) (unstyled : bool) (wrap_weaved_
|
||||
Cli.debug_flag := debug;
|
||||
Cli.style_flag := not unstyled;
|
||||
Cli.debug_print "Reading files...";
|
||||
if Filename.extension source_file <> ".catala" then
|
||||
Errors.raise_error
|
||||
(Printf.sprintf "Source file %s must have the .catala extension!" source_file);
|
||||
let language =
|
||||
match language with
|
||||
| Some l ->
|
||||
|
@ -385,8 +385,7 @@ let rec lex_law (lexbuf : lexbuf) : token =
|
||||
let pages = try Some (int_of_string (get_component 3)) with Not_found -> None in
|
||||
let pos = lexing_positions lexbuf in
|
||||
if Filename.extension name = ".pdf" then LAW_INCLUDE (Ast.PdfFile ((name, pos), pages))
|
||||
else if Filename.extension name = ".catala" then LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
else raise_lexer_error (lexing_positions lexbuf) name "this type of file cannot be included"
|
||||
else LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
| "@@", Plus (Compl '@'), "@@", Star '+' ->
|
||||
let extract_code_title = R.regexp "@@([^@]+)@@([\\+]*)" in
|
||||
let get_match = R.get_substring (R.exec ~rex:extract_code_title (Utf8.lexeme lexbuf)) in
|
||||
|
@ -338,15 +338,9 @@ let rec lex_law_en (lexbuf : lexbuf) : token =
|
||||
L.code_string_acc := "";
|
||||
BEGIN_CODE
|
||||
| eof -> EOF
|
||||
| "@@", Star white_space, "Master file", Star white_space, "@@" ->
|
||||
Cli.debug_print "A1";
|
||||
MASTER_FILE
|
||||
| "@@", Star white_space, "Begin metadata", Star white_space, "@@" ->
|
||||
Cli.debug_print "A1";
|
||||
BEGIN_METADATA
|
||||
| "@@", Star white_space, "End metadata", Star white_space, "@@" ->
|
||||
Cli.debug_print "A1";
|
||||
END_METADATA
|
||||
| "@@", Star white_space, "Master file", Star white_space, "@@" -> MASTER_FILE
|
||||
| "@@", Star white_space, "Begin metadata", Star white_space, "@@" -> BEGIN_METADATA
|
||||
| "@@", Star white_space, "End metadata", Star white_space, "@@" -> END_METADATA
|
||||
| ( "@@",
|
||||
Star white_space,
|
||||
"Include:",
|
||||
@ -363,8 +357,7 @@ let rec lex_law_en (lexbuf : lexbuf) : token =
|
||||
let pages = try Some (int_of_string (get_component 3)) with Not_found -> None in
|
||||
let pos = lexing_positions lexbuf in
|
||||
if Filename.extension name = ".pdf" then LAW_INCLUDE (Ast.PdfFile ((name, pos), pages))
|
||||
else if Filename.extension name = ".catala" then LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
else L.raise_lexer_error (lexing_positions lexbuf) name "this type of file cannot be included"
|
||||
else LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
| "@@", Plus (Compl '@'), "@@", Star '+' ->
|
||||
let extract_code_title = R.regexp "@@([^@]+)@@([\\+]*)" in
|
||||
let get_match = R.get_substring (R.exec ~rex:extract_code_title (Utf8.lexeme lexbuf)) in
|
||||
|
@ -373,8 +373,7 @@ let rec lex_law_fr (lexbuf : lexbuf) : token =
|
||||
let pos = lexing_positions lexbuf in
|
||||
if R.pmatch ~rex:jorftext name then LAW_INCLUDE (Ast.LegislativeText (name, pos))
|
||||
else if Filename.extension name = ".pdf" then LAW_INCLUDE (Ast.PdfFile ((name, pos), pages))
|
||||
else if Filename.extension name = ".catala" then LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
else L.raise_lexer_error (lexing_positions lexbuf) name "this type of file cannot be included"
|
||||
else LAW_INCLUDE (Ast.CatalaFile (name, pos))
|
||||
| "@@", Plus (Compl '@'), "@@", Star '+' ->
|
||||
let extract_code_title = R.regexp "@@([^@]+)@@([\\+]*)" in
|
||||
let get_match = R.get_substring (R.exec ~rex:extract_code_title (Utf8.lexeme lexbuf)) in
|
||||
|
@ -139,7 +139,7 @@ let rec parse_source_files (source_files : string list) (language : Cli.frontend
|
||||
| [] -> { program_items = []; program_source_files = [] }
|
||||
| source_file :: rest -> (
|
||||
Cli.debug_print (Printf.sprintf "Parsing %s" source_file);
|
||||
let input = open_in source_file in
|
||||
let input = try open_in source_file with Sys_error msg -> Errors.raise_error msg in
|
||||
let lexbuf = Sedlexing.Utf8.from_channel input in
|
||||
Sedlexing.set_filename lexbuf source_file;
|
||||
Parse_utils.current_file := source_file;
|
||||
|
@ -1,5 +1,5 @@
|
||||
'fileTypes' : [
|
||||
'catala'
|
||||
'catala_en'
|
||||
]
|
||||
'name' : 'catala_en'
|
||||
'patterns' : [
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
name = catala_en
|
||||
file_extensions [] = catala;
|
||||
file_extensions [] = catala_en;
|
||||
|
||||
################################################################
|
||||
## Styles
|
||||
|
@ -8,7 +8,7 @@ __all__=['CatalaEnLexer']
|
||||
class CatalaEnLexer(RegexLexer):
|
||||
name = 'CatalaEn'
|
||||
aliases = ['catala_en']
|
||||
filenames = ['*.catala']
|
||||
filenames = ['*.catala_en']
|
||||
flags = re.MULTILINE | re.UNICODE
|
||||
|
||||
tokens = {
|
||||
|
@ -6,7 +6,7 @@ if grep -q "CatalaEnLexer" pygments/pygments/pygments/lexers/_mapping.py
|
||||
then
|
||||
:
|
||||
else
|
||||
sed -i "78i\\ 'CatalaEnLexer': ('pygments.lexers.catala_en', 'CatalaEn', ('catala_en'), ('*.catala'), ('text/x-catala-en',))," pygments/pygments/pygments/lexers/_mapping.py
|
||||
sed -i "78i\\ 'CatalaEnLexer': ('pygments.lexers.catala_en', 'CatalaEn', ('catala_en'), ('*.catala_en'), ('text/x-catala-en',))," pygments/pygments/pygments/lexers/_mapping.py
|
||||
fi
|
||||
cd pygments/pygments
|
||||
virtualenv -p python3 env
|
||||
|
@ -1,5 +1,5 @@
|
||||
'fileTypes' : [
|
||||
'catala'
|
||||
'catala_fr'
|
||||
]
|
||||
'name' : 'catala_fr'
|
||||
'patterns' : [
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
name = catala_fr
|
||||
file_extensions [] = catala;
|
||||
file_extensions [] = catala_fr;
|
||||
|
||||
################################################################
|
||||
## Styles
|
||||
|
@ -8,7 +8,7 @@ __all__=['CatalaFrLexer']
|
||||
class CatalaFrLexer(RegexLexer):
|
||||
name = 'CatalaFr'
|
||||
aliases = ['catala_fr']
|
||||
filenames = ['*.catala']
|
||||
filenames = ['*.catala_fr']
|
||||
flags = re.MULTILINE | re.UNICODE
|
||||
|
||||
tokens = {
|
||||
|
@ -6,7 +6,7 @@ if grep -q "CatalaFrLexer" pygments/pygments/pygments/lexers/_mapping.py
|
||||
then
|
||||
:
|
||||
else
|
||||
sed -i "78i\\ 'CatalaFrLexer': ('pygments.lexers.catala_fr', 'CatalaFr', ('catala_fr'), ('*.catala'), ('text/x-catala-fr',))," pygments/pygments/pygments/lexers/_mapping.py
|
||||
sed -i "78i\\ 'CatalaFrLexer': ('pygments.lexers.catala_fr', 'CatalaFr', ('catala_fr'), ('*.catala_fr'), ('text/x-catala-fr',))," pygments/pygments/pygments/lexers/_mapping.py
|
||||
fi
|
||||
cd pygments/pygments
|
||||
virtualenv -p python3 env
|
||||
|
184
syntax_highlighting/nv/atom/grammars/catala_nv.cson
Normal file
184
syntax_highlighting/nv/atom/grammars/catala_nv.cson
Normal file
@ -0,0 +1,184 @@
|
||||
'fileTypes' : [
|
||||
'catala'
|
||||
]
|
||||
'name' : 'catala_nv'
|
||||
'patterns' : [
|
||||
{
|
||||
'include' : '#main'
|
||||
}
|
||||
]
|
||||
'scopeName' : 'source.catala_nv'
|
||||
'uuid' : ''
|
||||
'repository' : {
|
||||
'main' : {
|
||||
'patterns' : [
|
||||
{
|
||||
'begin' : '(@@)'
|
||||
'beginCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'markup.heading.title.catala_nv'
|
||||
}
|
||||
}
|
||||
'patterns' : [
|
||||
{
|
||||
'include' : '#main__1'
|
||||
}
|
||||
]
|
||||
'end' : '(@@[\\+]*)'
|
||||
'endCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'markup.heading.title.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
'begin' : '(@)'
|
||||
'beginCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'markup.heading.subtitle.catala_nv'
|
||||
}
|
||||
}
|
||||
'patterns' : [
|
||||
{
|
||||
'include' : '#main__2'
|
||||
}
|
||||
]
|
||||
'end' : '(@)'
|
||||
'endCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'markup.heading.subtitle.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
'match' : '([^\\/])'
|
||||
'name' : 'entity.law.catala_nv'
|
||||
}
|
||||
{
|
||||
'begin' : '(\\/\\*)'
|
||||
'beginCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'comment.block.documentation.catala_nv'
|
||||
}
|
||||
}
|
||||
'patterns' : [
|
||||
{
|
||||
'include' : '#code'
|
||||
}
|
||||
]
|
||||
'end' : '(\\*\\/)'
|
||||
'endCaptures' : {
|
||||
'1' : {
|
||||
'name' : 'comment.block.documentation.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
'code' : {
|
||||
'patterns' : [
|
||||
{
|
||||
'match' : '(\\s*\\#.*$)'
|
||||
'name' : 'comment.line.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '(param)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
|
||||
'captures' : {
|
||||
'1' : {
|
||||
'name' : 'keyword.other.catala_nv'
|
||||
}
|
||||
'2' : {
|
||||
'name' : 'text.catala_nv'
|
||||
}
|
||||
'3' : {
|
||||
'name' : 'entity.name.function.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
'match' : '\\b(match|with|fixed|by|decreasing|increasing|varies|with\\s+param|we\\s+have|in|such\\s+that|exists|for|all|of|if|then|else)\\b'
|
||||
'name' : 'keyword.control.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b(scope|fun\\s+of|new|includes|set|type|option|struct|enume|param|rule|condition|data|ok|assert|def)\\b'
|
||||
'name' : 'keyword.other.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '(\\|[0-9]+/[0-9]+/[0-9]+\\|)'
|
||||
'name' : 'constant.numeric.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b(true|false)\\b'
|
||||
'name' : 'constant.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b([0-9]+(,[0.9]*|))\\b'
|
||||
'name' : 'constant.numeric.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '(\\-\\-|\\;|\\.|\\,|\\:=|\\:|\\(|\\)|\\[|\\])'
|
||||
'name' : 'punctuation.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\\\\$|%|year|month|day)'
|
||||
'name' : 'keyword.operator.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b(int|bool|date|amount|text|decimal|number|sum|now)\\b'
|
||||
'name' : 'support.type.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b([A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)(\\.)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
|
||||
'captures' : {
|
||||
'1' : {
|
||||
'name' : 'entity.name.class.catala_nv'
|
||||
}
|
||||
'2' : {
|
||||
'name' : 'punctuation.catala_nv'
|
||||
}
|
||||
'3' : {
|
||||
'name' : 'entity.name.function.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
'match' : '\\b([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)(\\.)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\'\\.]*)\\b'
|
||||
'captures' : {
|
||||
'1' : {
|
||||
'name' : 'entity.name.function.catala_nv'
|
||||
}
|
||||
'2' : {
|
||||
'name' : 'punctuation.catala_nv'
|
||||
}
|
||||
'3' : {
|
||||
'name' : 'meta.variable_id.catala_nv'
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
'match' : '\\b([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
|
||||
'name' : 'entity.name.function.catala_nv'
|
||||
}
|
||||
{
|
||||
'match' : '\\b([A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)\\b'
|
||||
'name' : 'entity.name.class.catala_nv'
|
||||
}
|
||||
]
|
||||
}
|
||||
'main__1' : {
|
||||
'patterns' : [
|
||||
{
|
||||
'match' : '(.)'
|
||||
'name' : 'markup.heading.title.catala_nv'
|
||||
}
|
||||
]
|
||||
}
|
||||
'main__2' : {
|
||||
'patterns' : [
|
||||
{
|
||||
'match' : '(.)'
|
||||
'name' : 'markup.heading.subtitle.catala_nv'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
17
syntax_highlighting/nv/atom/package.json
Normal file
17
syntax_highlighting/nv/atom/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "language-catala-nv",
|
||||
"version": "1.0.0",
|
||||
"description": "Syntax highlighting for the Catala language",
|
||||
"engines": {
|
||||
"atom": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitlab.inria.fr/verifisc/catala.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitlab.inria.fr/verifisc/catala/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"license": "Apache"
|
||||
}
|
274
syntax_highlighting/nv/catala_nv.iro
Normal file
274
syntax_highlighting/nv/catala_nv.iro
Normal file
@ -0,0 +1,274 @@
|
||||
# This file is part of the Catala compiler, a specification language for tax and social benefits
|
||||
# computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
|
||||
# <denis.merigoux@inria.fr>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
# in compliance with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
# or implied. See the License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
|
||||
name = catala_nv
|
||||
file_extensions [] = catala;
|
||||
|
||||
################################################################
|
||||
## Styles
|
||||
################################################################
|
||||
|
||||
styles [] {
|
||||
|
||||
.comment : style {
|
||||
color = light_green
|
||||
italic = true
|
||||
textmate_scope = comment.line
|
||||
pygments_scope = Comment.Single
|
||||
}
|
||||
|
||||
.sc_id : style {
|
||||
textmate_scope = meta.variable_id
|
||||
pygments_scope = String
|
||||
color = violet_red
|
||||
}
|
||||
|
||||
.sc_id_def : style {
|
||||
textmate_scope = entity.name.function
|
||||
pygments_scope = Name.Variable
|
||||
color = orange
|
||||
}
|
||||
|
||||
|
||||
.cc_id : style {
|
||||
color = light_blue
|
||||
textmate_scope = entity.name.class
|
||||
pygments_scope = Name.Class
|
||||
}
|
||||
|
||||
|
||||
.law_title : style {
|
||||
color = yellow
|
||||
italic = false
|
||||
textmate_scope = markup.heading.title
|
||||
pygments_scope = Generic.Heading
|
||||
}
|
||||
|
||||
.law_subtitle : style {
|
||||
color = gold
|
||||
italic = true
|
||||
textmate_scope = markup.heading.subtitle
|
||||
pygments_scope = Generic.Heading
|
||||
}
|
||||
|
||||
.law : style {
|
||||
color = light_yellow
|
||||
italic = false
|
||||
textmate_scope = entity.law
|
||||
pygments_scope = String
|
||||
}
|
||||
|
||||
.code_delimiter : style {
|
||||
color = grey
|
||||
italic = false
|
||||
textmate_scope = comment.block.documentation
|
||||
pygments_scope = String
|
||||
}
|
||||
|
||||
.primitive : style {
|
||||
color = purple
|
||||
textmate_scope = support.type
|
||||
pygments_scope = Keyword.Type
|
||||
}
|
||||
|
||||
.whitespace : style {
|
||||
textmate_scope = text
|
||||
pygments_scope = String
|
||||
}
|
||||
|
||||
.keyword_expression : style {
|
||||
color = pink
|
||||
textmate_scope = keyword.control
|
||||
pygments_scope = Keyword.Reserved
|
||||
}
|
||||
|
||||
.keyword_rule : style {
|
||||
color = cyan
|
||||
textmate_scope = keyword.other
|
||||
pygments_scope = Keyword.Declaration
|
||||
}
|
||||
|
||||
.punctuation : style {
|
||||
color = red_2
|
||||
ace_scope = punctuation
|
||||
textmate_scope = punctuation
|
||||
pygments_scope = Operator
|
||||
}
|
||||
|
||||
.literal : style {
|
||||
color = green
|
||||
textmate_scope = constant
|
||||
pygments_scope = Keyword.Constant
|
||||
}
|
||||
|
||||
.literal_numeric : style {
|
||||
color = violet
|
||||
textmate_scope = constant.numeric
|
||||
pygments_scope = Number.Integer
|
||||
}
|
||||
|
||||
|
||||
.operator : style {
|
||||
color = brown
|
||||
textmate_scope = keyword.operator
|
||||
pygments_scope = Operator
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#################################################
|
||||
## Parse contexts
|
||||
#################################################
|
||||
|
||||
__LOWER_CHARS \= a-zéèàâùîêœç
|
||||
|
||||
__UPPER_CHARS \= A-ZÉÈÀÂÙÎÊŒÇ
|
||||
|
||||
__SC_ID \= [$${__LOWER_CHARS}][$${__LOWER_CHARS}$${__UPPER_CHARS}0-9_\']*
|
||||
|
||||
__SC_ID_COMPOSED \= [$${__LOWER_CHARS}][$${__LOWER_CHARS}$${__UPPER_CHARS}0-9_\'\.]*
|
||||
|
||||
__CC_ID \= [$${__UPPER_CHARS}][$${__LOWER_CHARS}$${__UPPER_CHARS}0-9_\']*
|
||||
|
||||
contexts [] {
|
||||
|
||||
##############################################
|
||||
## Main Context - Entry point context
|
||||
##############################################
|
||||
|
||||
main : context {
|
||||
|
||||
: inline_push {
|
||||
regex \= (@@)
|
||||
styles [] = .law_title;
|
||||
: pop {
|
||||
regex \= (@@[\+]*)
|
||||
styles [] = .law_title;
|
||||
}
|
||||
: pattern {
|
||||
regex \= (.)
|
||||
styles [] = .law_title;
|
||||
}
|
||||
}
|
||||
|
||||
: inline_push {
|
||||
regex \= (@)
|
||||
styles [] = .law_subtitle;
|
||||
: pop {
|
||||
regex \= (@)
|
||||
styles [] = .law_subtitle;
|
||||
}
|
||||
: pattern {
|
||||
regex \= (.)
|
||||
styles [] = .law_subtitle;
|
||||
}
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= ([^\/])
|
||||
styles [] = .law;
|
||||
}
|
||||
|
||||
: push {
|
||||
regex \= (\/\*)
|
||||
styles [] = .code_delimiter;
|
||||
context [] = code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
code : context {
|
||||
|
||||
: pop {
|
||||
regex \= (\*\/)
|
||||
styles [] = .code_delimiter;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= (\s*\#.*$)
|
||||
styles [] = .comment ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= (param)(\s+)($${__SC_ID})
|
||||
styles [] = .keyword_rule, .whitespace, .sc_id_def;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(match|with|fixed|by|decreasing|increasing|varies|with\s+param|we\s+have|in|such\s+that|exists|for|all|of|if|then|else)\b
|
||||
styles [] = .keyword_expression ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(scope|fun\s+of|new|includes|set|type|option|struct|enume|param|rule|condition|data|ok|assert|def)\b
|
||||
styles [] = .keyword_rule ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= (\|[0-9]+/[0-9]+/[0-9]+\|)
|
||||
styles [] = .literal_numeric ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(true|false)\b
|
||||
styles [] = .literal ;
|
||||
}
|
||||
|
||||
|
||||
: pattern {
|
||||
regex \= \b([0-9]+(,[0.9]*|))\b
|
||||
styles [] = .literal_numeric ;
|
||||
}
|
||||
|
||||
|
||||
: pattern {
|
||||
regex \= (\-\-|\;|\.|\,|\:=|\:|\(|\)|\[|\])
|
||||
styles [] = .punctuation;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= (\-\>|\+|\-|\*|/|\!|not|or|and|=|>|<|\\$|%|year|month|day)
|
||||
styles [] = .operator;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b(int|bool|date|amount|text|decimal|number|sum|now)\b
|
||||
styles [] = .primitive;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b($${__CC_ID})(\.)($${__SC_ID})\b
|
||||
styles [] = .cc_id, .punctuation, .sc_id_def ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b($${__SC_ID})(\.)($${__SC_ID_COMPOSED})\b
|
||||
styles [] = .sc_id_def, .punctuation, .sc_id ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b($${__SC_ID})\b
|
||||
styles [] = .sc_id_def ;
|
||||
}
|
||||
|
||||
: pattern {
|
||||
regex \= \b($${__CC_ID})\b
|
||||
styles [] = .cc_id ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
51
syntax_highlighting/nv/pygments/catala_nv.py
Normal file
51
syntax_highlighting/nv/pygments/catala_nv.py
Normal file
@ -0,0 +1,51 @@
|
||||
from pygments.lexer import RegexLexer, bygroups
|
||||
from pygments.token import *
|
||||
|
||||
import re
|
||||
|
||||
__all__=['CatalaNvLexer']
|
||||
|
||||
class CatalaNvLexer(RegexLexer):
|
||||
name = 'CatalaNv'
|
||||
aliases = ['catala_nv']
|
||||
filenames = ['*.catala']
|
||||
flags = re.MULTILINE | re.UNICODE
|
||||
|
||||
tokens = {
|
||||
'root' : [
|
||||
(u'(@@)', bygroups(Generic.Heading), 'main__1'),
|
||||
(u'(@)', bygroups(Generic.Heading), 'main__2'),
|
||||
(u'([^\\/\\n\\r])', bygroups(Text)),
|
||||
(u'(\\/\\*)', bygroups(Text), 'code'),
|
||||
('(\n|\r|\r\n)', Text),
|
||||
('.', Text),
|
||||
],
|
||||
'code' : [
|
||||
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
|
||||
(u'(param)(\\s+)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)', bygroups(Keyword.Declaration, Text, Name.Variable)),
|
||||
(u'\\b(match|with|fixed|by|decreasing|increasing|varies|with\\s+param|we\\s+have|in|such\\s+that|exists|for|all|of|if|then|else)\\b', bygroups(Keyword.Reserved)),
|
||||
(u'\\b(scope|fun\\s+of|new|includes|set|type|option|struct|enume|param|rule|condition|data|ok|assert|def)\\b', bygroups(Keyword.Declaration)),
|
||||
(u'(\\|[0-9]+/[0-9]+/[0-9]+\\|)', bygroups(Number.Integer)),
|
||||
(u'\\b(true|false)\\b', bygroups(Keyword.Constant)),
|
||||
(u'\\b([0-9]+(,[0.9]*|))\\b', bygroups(Number.Integer)),
|
||||
(u'(\\-\\-|\\;|\\.|\\,|\\:=|\\:|\\(|\\)|\\[|\\])', bygroups(Operator)),
|
||||
(u'(\\-\\>|\\+|\\-|\\*|/|\\!|not|or|and|=|>|<|\\\\$|%|year|month|day)', bygroups(Operator)),
|
||||
(u'\\b(int|bool|date|amount|text|decimal|number|sum|now)\\b', bygroups(Keyword.Type)),
|
||||
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class, Operator, Name.Variable)),
|
||||
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)(\\.)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\'\\.]*)\\b', bygroups(Name.Variable, Operator, Text)),
|
||||
(u'\\b([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Variable)),
|
||||
(u'\\b([A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)\\b', bygroups(Name.Class)),
|
||||
('(\n|\r|\r\n)', Text),
|
||||
('.', Text),
|
||||
],
|
||||
'main__1' : [
|
||||
(u'(.)', bygroups(Generic.Heading)),
|
||||
('(\n|\r|\r\n)', Text),
|
||||
('.', Text),
|
||||
],
|
||||
'main__2' : [
|
||||
(u'(.)', bygroups(Generic.Heading)),
|
||||
('(\n|\r|\r\n)', Text),
|
||||
('.', Text),
|
||||
]
|
||||
}
|
1
syntax_highlighting/nv/pygments/pygments
Submodule
1
syntax_highlighting/nv/pygments/pygments
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 057fbfba1ab575b3e19a8d93c68451b18bd8bc59
|
14
syntax_highlighting/nv/set_up_pygments.sh
Normal file
14
syntax_highlighting/nv/set_up_pygments.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
ln -s -f $(pwd)/pygments/catala_en.py pygments/pygments/pygments/lexers/catala_nv.py
|
||||
if grep -q "CatalaNvLexer" pygments/pygments/pygments/lexers/_mapping.py
|
||||
then
|
||||
:
|
||||
else
|
||||
sed -i "78i\\ 'CatalaEnLexer': ('pygments.lexers.catala_nv', 'CatalaNv', ('catala_nv'), ('*.catala'), ('text/x-catala-nv',))," pygments/pygments/pygments/lexers/_mapping.py
|
||||
fi
|
||||
cd pygments/pygments
|
||||
virtualenv -p python3 env
|
||||
source env/bin/activate
|
||||
python3 setup.py install
|
8
syntax_highlighting/nv/setup_atom.sh
Executable file
8
syntax_highlighting/nv/setup_atom.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
FILE=~/.atom/packages/catala_nv
|
||||
|
||||
if [ ! -L "$FILE" ]; then
|
||||
echo "Creating link"
|
||||
ln -s -f $(dirname "$0")/atom "$FILE"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user