fazer-lang 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -42
- package/docs/README.md +26 -0
- package/docs/examples.md +60 -0
- package/docs/getting-started.md +153 -0
- package/docs/stdlib.md +111 -0
- package/docs/syntax.md +86 -0
- package/fazer.js +521 -7
- package/package.json +13 -5
- package/tools/announce.fz +48 -0
- package/tools/builder.js +208 -0
package/README.md
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
1
|
# Fazer
|
|
2
2
|
|
|
3
|
-
**Fazer**
|
|
3
|
+
**Fazer** — Le langage de script nouvelle génération par **L'EMPRISE**.
|
|
4
|
+
|
|
5
|
+
Conçu pour l'automatisation, la sécurité et le traitement de données, Fazer combine une syntaxe concise avec une bibliothèque standard "batteries included".
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Installez Fazer globalement via npm :
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
npm install -g fazer-lang
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
Run the REPL (interactive mode):
|
|
15
|
+
## Utilisation Rapide
|
|
16
16
|
|
|
17
|
+
Lancer le REPL (mode interactif) :
|
|
17
18
|
```bash
|
|
18
19
|
fazer
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
Exécuter un script :
|
|
23
23
|
```bash
|
|
24
|
-
fazer
|
|
24
|
+
fazer mon_script.fz
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
## Création d'Exécutable (.exe)
|
|
28
|
+
|
|
29
|
+
Transformez vos scripts Fazer en applications Windows portables et natives :
|
|
30
|
+
|
|
31
|
+
1. (Optionnel) Placez une icône `app.ico` dans le dossier.
|
|
32
|
+
2. Lancez la commande de build :
|
|
33
|
+
```bash
|
|
34
|
+
fazer build mon_script.fz
|
|
35
|
+
```
|
|
36
|
+
3. Récupérez votre application dans `dist/mon_script/mon_script.exe`.
|
|
37
|
+
|
|
38
|
+
Le dossier généré est **portable** : zippez-le et envoyez-le à n'importe qui, aucune installation n'est requise !
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
La documentation complète est disponible dans le dossier [`docs/`](./docs/README.md).
|
|
43
|
+
|
|
44
|
+
* [Guide de Démarrage](./docs/getting-started.md)
|
|
45
|
+
* [Syntaxe du Langage](./docs/syntax.md)
|
|
46
|
+
* [Bibliothèque Standard (Stdlib)](./docs/stdlib.md)
|
|
47
|
+
* [Exemples](./docs/examples.md)
|
|
48
|
+
|
|
49
|
+
## Fonctionnalités Clés
|
|
50
|
+
|
|
51
|
+
* **GUI Native** : Créez de vraies applications Windows (WinForms) avec widgets natifs (`window`, `button`, `entry`, etc.).
|
|
52
|
+
* **Pipe Operator (`->>`)** : Enchaînez les opérations proprement.
|
|
53
|
+
* **Pattern Matching (`case`)** : Contrôle de flux expressif.
|
|
54
|
+
* **Sécurité Intégrée** : Chiffrement AES-256-GCM et SHA256 natifs.
|
|
55
|
+
* **Réseau & Web** : Client HTTP `fetch`, serveur web `server`, et module `discord`.
|
|
56
|
+
* **Système de Fichiers** : Manipulation simple et puissante.
|
|
57
|
+
* **Automation** : Gestion du presse-papier (`clipboard`), notifications (`notify`), et persistance (`db`).
|
|
58
|
+
* **Extensible** : Système de modules `import`.
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Copyright
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
© 2024 **L'EMPRISE**. Tous droits réservés.
|
|
63
|
+
Distribué sous licence MIT.
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Documentation Fazer
|
|
2
|
+
|
|
3
|
+
Bienvenue dans la documentation officielle du langage **Fazer**.
|
|
4
|
+
|
|
5
|
+
## Table des Matières
|
|
6
|
+
|
|
7
|
+
1. **[Guide de Démarrage](./getting-started.md)**
|
|
8
|
+
* Installation
|
|
9
|
+
* Votre premier script
|
|
10
|
+
* Mode interactif (REPL)
|
|
11
|
+
|
|
12
|
+
2. **[Syntaxe du Langage](./syntax.md)**
|
|
13
|
+
* Variables et Types
|
|
14
|
+
* Opérateur Pipe (`->>`)
|
|
15
|
+
* Contrôle de Flux (`case`)
|
|
16
|
+
* Fonctions
|
|
17
|
+
|
|
18
|
+
3. **[Bibliothèque Standard (Stdlib)](./stdlib.md)**
|
|
19
|
+
* E/S Console (`println`, `ask`...)
|
|
20
|
+
* Système de Fichiers (`readText`, `writeText`...)
|
|
21
|
+
* Chiffrement (`encText`, `sha256`...)
|
|
22
|
+
* Réseau & Web (`server`, `fetch`, `discord`...)
|
|
23
|
+
* Utilitaires (`json`, `exec`...)
|
|
24
|
+
|
|
25
|
+
4. **[Exemples](./examples.md)**
|
|
26
|
+
* Scripts complets pour apprendre par l'exemple.
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Exemples Fazer
|
|
2
|
+
|
|
3
|
+
## 1. Hello World
|
|
4
|
+
|
|
5
|
+
```fazer
|
|
6
|
+
"Hello World" ->> println
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 2. Demander le nom
|
|
10
|
+
|
|
11
|
+
```fazer
|
|
12
|
+
"Quel est votre nom ? " ->> ask ->> println
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 3. Chiffrement de Fichier (Logique simplifiée)
|
|
16
|
+
|
|
17
|
+
Ce script montre comment on pourrait structurer un outil de chiffrement.
|
|
18
|
+
|
|
19
|
+
```fazer
|
|
20
|
+
fn main () {
|
|
21
|
+
"1. Chiffrer" ->> println
|
|
22
|
+
"2. Déchiffrer" ->> println
|
|
23
|
+
"Choix : " ->> ask ->> case {
|
|
24
|
+
"1" : {
|
|
25
|
+
"Fichier à chiffrer : " ->> ask ->> enc_flow
|
|
26
|
+
}
|
|
27
|
+
"2" : {
|
|
28
|
+
"Fichier à déchiffrer : " ->> ask ->> dec_flow
|
|
29
|
+
}
|
|
30
|
+
_ : {
|
|
31
|
+
"Choix invalide" ->> println
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fn enc_flow (path) {
|
|
37
|
+
path ->> exists ->> case {
|
|
38
|
+
true : {
|
|
39
|
+
"Mot de passe : " ->> ask ->> pass
|
|
40
|
+
path ->> readText ->> encText(pass) ->> saveText(path)
|
|
41
|
+
"Fichier chiffré !" ->> println
|
|
42
|
+
}
|
|
43
|
+
_ : { "Fichier introuvable" ->> println }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Lancer le main
|
|
48
|
+
main()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 4. Serveur Web Simple
|
|
52
|
+
|
|
53
|
+
```fazer
|
|
54
|
+
fn handle_request (req) {
|
|
55
|
+
"<h1>Bienvenue sur Fazer Web</h1>" // Retourne le HTML
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
"Démarrage du serveur sur 8080..." ->> println
|
|
59
|
+
8080 ->> server("handle_request")
|
|
60
|
+
```
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Guide de Démarrage Fazer
|
|
2
|
+
|
|
3
|
+
Bienvenue dans Fazer, le langage de script puissant et moderne pour Windows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Téléchargez la dernière version.
|
|
8
|
+
2. Lancez `install_system.ps1` pour configurer le PATH et les associations de fichiers.
|
|
9
|
+
3. Ouvrez un terminal et tapez `fazer` pour lancer le REPL.
|
|
10
|
+
|
|
11
|
+
## Votre premier script
|
|
12
|
+
|
|
13
|
+
Créez un fichier `hello.fz` :
|
|
14
|
+
|
|
15
|
+
```fazer
|
|
16
|
+
"Bonjour Fazer !" ->> println
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Exécutez-le :
|
|
20
|
+
```bash
|
|
21
|
+
fazer run hello.fz
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Ou simplement (si installé) :
|
|
25
|
+
```bash
|
|
26
|
+
fazer hello.fz
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Concepts de Base
|
|
30
|
+
|
|
31
|
+
### Variables et Fonctions
|
|
32
|
+
|
|
33
|
+
```fazer
|
|
34
|
+
# Variable
|
|
35
|
+
nom := "Monde"
|
|
36
|
+
|
|
37
|
+
# Fonction
|
|
38
|
+
fn saluer(n) ->
|
|
39
|
+
"Bonjour " + n
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
saluer(nom) ->> println
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Pipe (`->>`)
|
|
46
|
+
|
|
47
|
+
L'opérateur pipe passe le résultat de gauche comme premier argument à la fonction de droite.
|
|
48
|
+
|
|
49
|
+
```fazer
|
|
50
|
+
" texte sale " ->> str_trim ->> str_upper ->> println
|
|
51
|
+
# Affiche : "TEXTE SALE"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Bibliothèque Standard (Nouveau !)
|
|
55
|
+
|
|
56
|
+
Fazer dispose maintenant d'une bibliothèque standard riche pour les tâches réelles.
|
|
57
|
+
|
|
58
|
+
### 1. Système de Fichiers
|
|
59
|
+
```fazer
|
|
60
|
+
# Lire
|
|
61
|
+
contenu := fs_read("config.txt")
|
|
62
|
+
|
|
63
|
+
# Écrire
|
|
64
|
+
fs_write("log.txt", "Succès")
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Modules (`import`)
|
|
68
|
+
Organisez votre code en plusieurs fichiers.
|
|
69
|
+
|
|
70
|
+
**math.fz** :
|
|
71
|
+
```fazer
|
|
72
|
+
add := (a, b) => a + b
|
|
73
|
+
PI := 3.14159
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**main.fz** :
|
|
77
|
+
```fazer
|
|
78
|
+
m := import("math.fz")
|
|
79
|
+
m.add(10, 5) ->> println
|
|
80
|
+
m.PI ->> println
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. Base de Données Native (`db`)
|
|
84
|
+
Persistance des données JSON simple et efficace.
|
|
85
|
+
|
|
86
|
+
```fazer
|
|
87
|
+
# Initialiser (charge ou crée le fichier)
|
|
88
|
+
store := db("data.json")
|
|
89
|
+
|
|
90
|
+
# Sauvegarder une valeur
|
|
91
|
+
store.set("score", 100)
|
|
92
|
+
store.set("user", "viced")
|
|
93
|
+
|
|
94
|
+
# Lire une valeur
|
|
95
|
+
store.get("score") ->> println
|
|
96
|
+
|
|
97
|
+
# Récupérer tout
|
|
98
|
+
all := store.all()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 4. Automation Système
|
|
102
|
+
Interagissez avec Windows.
|
|
103
|
+
|
|
104
|
+
```fazer
|
|
105
|
+
# Presse-papier (Copier)
|
|
106
|
+
clipboard_set("Copié depuis Fazer !")
|
|
107
|
+
|
|
108
|
+
# Notifications
|
|
109
|
+
notify("Titre", "Ceci est une notification Windows native")
|
|
110
|
+
|
|
111
|
+
# Exécution de commandes
|
|
112
|
+
ip := exec("ipconfig")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. GUI Native (Vrai Native)
|
|
116
|
+
Créez des applications Windows natives (WinForms) directement en Fazer.
|
|
117
|
+
|
|
118
|
+
```fazer
|
|
119
|
+
# 1. Définir l'interface
|
|
120
|
+
window("Mon Application", 400, 300)
|
|
121
|
+
label("lbl_msg", "Bienvenue !", 20, 20, 360, 30)
|
|
122
|
+
button("btn_ok", "Cliquez-moi", 20, 60, 150, 40)
|
|
123
|
+
entry("txt_nom", "Votre nom", 20, 120, 360, 30)
|
|
124
|
+
|
|
125
|
+
# 2. Gestionnaire d'événements
|
|
126
|
+
fn handler(ev) ->
|
|
127
|
+
id = ev["id"]
|
|
128
|
+
|
|
129
|
+
if id == "btn_ok"
|
|
130
|
+
msgbox("Bouton cliqué !")
|
|
131
|
+
set_text("lbl_msg", "Merci !")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if id == "txt_nom"
|
|
135
|
+
# ev["value"] contient le texte tapé
|
|
136
|
+
print("Nom changé: " + ev["value"])
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# 3. Lancer l'interface
|
|
141
|
+
gui(handler)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 6. Serveur Web
|
|
145
|
+
Créez des API ou des sites web.
|
|
146
|
+
|
|
147
|
+
```fazer
|
|
148
|
+
fn handler(req) ->
|
|
149
|
+
"Vous avez demandé : " + req.url
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
server(8080, handler)
|
|
153
|
+
```
|
package/docs/stdlib.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Bibliothèque Standard (Stdlib)
|
|
2
|
+
|
|
3
|
+
Fazer inclut une bibliothèque standard "batteries included" pour le développement d'applications robustes.
|
|
4
|
+
|
|
5
|
+
## Système de Fichiers (fs)
|
|
6
|
+
|
|
7
|
+
Manipulation de fichiers synchrones et performante.
|
|
8
|
+
|
|
9
|
+
### `fs_read(path)`
|
|
10
|
+
Lit le contenu d'un fichier en texte (UTF-8). Retourne `null` en cas d'erreur.
|
|
11
|
+
```fazer
|
|
12
|
+
content := fs_read("config.json")
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### `fs_write(path, content)`
|
|
16
|
+
Écrit (écrase) du contenu dans un fichier. Retourne `true` si succès.
|
|
17
|
+
```fazer
|
|
18
|
+
fs_write("log.txt", "Initialisation...")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### `fs_append(path, content)`
|
|
22
|
+
Ajoute du contenu à la fin d'un fichier.
|
|
23
|
+
```fazer
|
|
24
|
+
fs_append("log.txt", "\nNouvelle entrée")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### `fs_exists(path)`
|
|
28
|
+
Vérifie si un fichier ou dossier existe.
|
|
29
|
+
```fazer
|
|
30
|
+
if fs_exists("data") -> ... end
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Manipulation de Données
|
|
34
|
+
|
|
35
|
+
### JSON
|
|
36
|
+
* `json_parse(str)` : Convertit une chaîne JSON en objet/liste.
|
|
37
|
+
* `json_stringify(obj)` : Convertit un objet en chaîne JSON formatée.
|
|
38
|
+
* Alias : `json(obj)`
|
|
39
|
+
|
|
40
|
+
### Chaînes de Caractères (String)
|
|
41
|
+
* `str_split(str, delimiter)` : Découpe une chaîne en liste.
|
|
42
|
+
* `str_replace(str, old, new)` : Remplace toutes les occurrences.
|
|
43
|
+
* `str_trim(str)` : Retire les espaces au début et à la fin.
|
|
44
|
+
* `str_upper(str)` : Convertit en majuscules.
|
|
45
|
+
* `str_lower(str)` : Convertit en minuscules.
|
|
46
|
+
|
|
47
|
+
### Mathématiques
|
|
48
|
+
* `random()` : Retourne un nombre aléatoire entre 0.0 et 1.0.
|
|
49
|
+
* `round(n)` : Arrondi à l'entier le plus proche.
|
|
50
|
+
* `floor(n)` : Arrondi à l'entier inférieur.
|
|
51
|
+
* `ceil(n)` : Arrondi à l'entier supérieur.
|
|
52
|
+
* `int(n)` : Conversion en entier.
|
|
53
|
+
* `float(n)` : Conversion en flottant.
|
|
54
|
+
|
|
55
|
+
## Base de Données (db)
|
|
56
|
+
|
|
57
|
+
### `db(path)`
|
|
58
|
+
Crée ou charge une base de données JSON persistante.
|
|
59
|
+
```fazer
|
|
60
|
+
store := db("data.json")
|
|
61
|
+
store.set("key", "value")
|
|
62
|
+
val := store.get("key")
|
|
63
|
+
data := store.all()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Automation & Système
|
|
67
|
+
|
|
68
|
+
### Presse-papier
|
|
69
|
+
* `clipboard_set(text)` : Copie du texte dans le presse-papier.
|
|
70
|
+
* `clipboard_get()` : Récupère le texte du presse-papier.
|
|
71
|
+
|
|
72
|
+
### Notifications
|
|
73
|
+
* `notify(title, msg)` : Affiche une notification système native.
|
|
74
|
+
|
|
75
|
+
### Exécution
|
|
76
|
+
* `exec(cmd)` : Exécute une commande système et capture la sortie.
|
|
77
|
+
* `sleep(ms)` : Pause l'exécution.
|
|
78
|
+
* `import(path)` : Charge un module Fazer externe.
|
|
79
|
+
|
|
80
|
+
## Interface Graphique (GUI Native)
|
|
81
|
+
|
|
82
|
+
Créez des applications Windows Forms natives.
|
|
83
|
+
|
|
84
|
+
### Widgets
|
|
85
|
+
* `window(title, width, height, icon_path)` : Définit la fenêtre principale. `icon_path` est optionnel (ex: `"app.ico"`).
|
|
86
|
+
* `button(id, text, x, y, w, h)` : Ajoute un bouton.
|
|
87
|
+
* `label(id, text, x, y, w, h)` : Ajoute une étiquette de texte.
|
|
88
|
+
* `entry(id, text, x, y, w, h)` : Ajoute un champ de saisie texte.
|
|
89
|
+
|
|
90
|
+
### Interaction
|
|
91
|
+
* `gui(handler)` : Lance la boucle d'événements. `handler` reçoit des événements `{id, type, value}`.
|
|
92
|
+
* `set_text(id, text)` : Change le texte d'un widget (à utiliser dans le handler).
|
|
93
|
+
* `msgbox(text)` : Affiche une boîte de dialogue modale.
|
|
94
|
+
|
|
95
|
+
## Réseau & Web
|
|
96
|
+
|
|
97
|
+
### `server(port, handler)`
|
|
98
|
+
Démarre un serveur HTTP.
|
|
99
|
+
```fazer
|
|
100
|
+
fn handler(req) ->
|
|
101
|
+
return({ "body": "Hello World" })
|
|
102
|
+
end
|
|
103
|
+
server(8080, handler)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `fetch(url, options)`
|
|
107
|
+
Effectue une requête HTTP asynchrone.
|
|
108
|
+
```fazer
|
|
109
|
+
res := fetch("https://api.example.com/data")
|
|
110
|
+
print(res.body)
|
|
111
|
+
```
|
package/docs/syntax.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Syntaxe du Langage Fazer
|
|
2
|
+
|
|
3
|
+
Fazer est un langage orienté flux. La plupart des opérations se font de gauche à droite via l'opérateur pipe.
|
|
4
|
+
|
|
5
|
+
## Commentaires
|
|
6
|
+
|
|
7
|
+
```fazer
|
|
8
|
+
// Ceci est un commentaire sur une ligne
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
Il n'y a pas de mot-clé de déclaration explicite comme `var` ou `let` pour l'assignation simple dans le flux, mais vous pouvez nommer des valeurs dans des arguments de fonctions.
|
|
14
|
+
|
|
15
|
+
Cependant, Fazer utilise principalement le passage de valeurs. Pour stocker des états globaux ou complexes, on utilise souvent des objets JSON ou la mémoire interne via `set`/`get`.
|
|
16
|
+
|
|
17
|
+
```fazer
|
|
18
|
+
// Exemple d'utilisation de set/get (mémoire clé-valeur)
|
|
19
|
+
"ma_valeur" "cle" ->> set
|
|
20
|
+
"cle" ->> get ->> println // Affiche "ma_valeur"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Opérateur Pipe (`->>`)
|
|
24
|
+
|
|
25
|
+
L'opérateur `->>` passe le résultat de l'expression de gauche comme **premier argument** de la fonction de droite.
|
|
26
|
+
|
|
27
|
+
```fazer
|
|
28
|
+
"Bonjour" ->> println
|
|
29
|
+
// Équivalent à println("Bonjour") dans d'autres langages
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Chaînage :
|
|
33
|
+
|
|
34
|
+
```fazer
|
|
35
|
+
"mot_de_passe" ->> sha256 ->> println
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Chaînes de Caractères et Nombres
|
|
39
|
+
|
|
40
|
+
```fazer
|
|
41
|
+
"Ceci est une chaîne"
|
|
42
|
+
123
|
|
43
|
+
12.34
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Fonctions (Définition)
|
|
47
|
+
|
|
48
|
+
Fazer supporte la définition de fonctions nommées.
|
|
49
|
+
|
|
50
|
+
```fazer
|
|
51
|
+
fn ma_fonction (arg1) {
|
|
52
|
+
arg1 ->> println
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
"test" ->> ma_fonction
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Contrôle de Flux : `case`
|
|
59
|
+
|
|
60
|
+
Fazer n'a pas de `if/else` traditionnel. Tout se fait via `case` (pattern matching).
|
|
61
|
+
|
|
62
|
+
```fazer
|
|
63
|
+
valeur ->> case {
|
|
64
|
+
"option1" : {
|
|
65
|
+
"C'est l'option 1" ->> println
|
|
66
|
+
}
|
|
67
|
+
"option2" : {
|
|
68
|
+
"C'est l'option 2" ->> println
|
|
69
|
+
}
|
|
70
|
+
_ : {
|
|
71
|
+
"Cas par défaut (wildcard)" ->> println
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Conditionnelle (If-Else simulé)
|
|
77
|
+
|
|
78
|
+
Pour faire un `if`, on matche souvent sur un booléen ou une valeur spécifique. Notez que Fazer évalue l'égalité stricte.
|
|
79
|
+
|
|
80
|
+
```fazer
|
|
81
|
+
// Exemple conceptuel
|
|
82
|
+
variable ->> case {
|
|
83
|
+
"vrai" : { ... }
|
|
84
|
+
_ : { ... }
|
|
85
|
+
}
|
|
86
|
+
```
|