From a67224413287e0e98801f29fe978b04262ba28f3 Mon Sep 17 00:00:00 2001
From: cesare <cesare@cesares-mbp-2>
Date: Tue, 13 Dec 2022 15:17:32 +0100
Subject: [PATCH] implementazione search, in progress

---
 js/utils.js | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/js/utils.js b/js/utils.js
index 085e8ef..aae53e6 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -136,6 +136,89 @@ _ "whitespace"= " "*
 
 `
 
+var categoriegrammaticaliGrammar=`Expression 
+	= head:(Filtro){return head.join()}
+	
+Filtro
+	= fhead:("v")? tail:( transitivita? diatesi? impersonalita?
+    						coniugazione? modotempo?
+                            persona? funzione? declinazione?
+                            genere? numero? grado?){return tail}
+    
+
+diatesi= [a|p] {if (text()=='a') return ' Attivo'; else return ' Passivo';}
+    
+transitivita=[i|t]? {if (text()=='t') return ' Transitivo'; else if (text()=='i') return ' Intransitivo';}
+
+impersonalita=([*|+])? {if (text()=='*') return ' Impersonale'; else if (text()=='+')return ' Riflessivo';}
+
+coniugazione=[1|2|3|4|5]? {switch(parseInt(text())){
+							case(1): return ' Prima coniugazione';
+                            case(2): return ' Seconda coniugazione';
+                            case(3): return ' Terza coniugazione';
+                            case(4): return ' Ausiliare essere'
+                            case(5): return ' Ausiliare avere'}}
+modotempo=modo:"ip" {return('Presente indicativo')}/
+			   "ib" {return("Passato Prossimo Indicativo")}/
+			   "ii" {return("Imperfetto Indicativo")}/
+              "ir" {return("PassatoRemotoIndicativo")}/
+              "is" {return( "TrapassatoProssimoIndicativo")}/
+              "it" {return( "TrapassatoRemotoIndicativo")}/
+              "if" {return("FuturoSempliceIndicativo")}/
+              "ia" {return("FuturoAnterioreIndicativo")}/
+              "cp" {return( "PresenteCongiuntivo")}/
+              "ci" {return( "ImperfettoCongiuntivo")}/
+              "cr" {return( "PassatoCongiuntivo")}/
+              "ct" {return( "TrapassatoCongiuntivo")}/
+              "dp" {return( "PresenteCondizionale")}/
+              "dr" {return( "PassatoCondizionale")}/
+              "mp" {return( "PresenteImperativo")}/
+              "fp" {return( "PresenteInfinito")}/
+              "fr" {return( "PassatoInfinito")}/
+              "pp" {return( "PresenteParticipio")}/
+              "pr" {return( "PassatoParticipio")}/
+              "gp" {return( "Presente gerundio")}/
+              "gr" {return( "PassatoGerundio")}/
+              "pf" {return( "ParticipioFuturo")} 
+persona="s1" {return('Prima persona singolare')}/
+		"s2" {return('Seconda persona singolare')}/
+        "s3" {return('Terza persona singolare')}/
+        "p1" {return('Prima persona plurale')}/
+        "p2" {return('Seconda persona plurale')}/
+        "p3" {return('Terza persona plurale')}
+
+
+funzione="a" {return('Verbo Funzione Aggettivo')}/
+		"sm" {return('Verbo Funzione Sostantivo maschile')}/
+        "sf" {return('Verbo Funzione Sostantivo femminile')}/
+        "b" {return('Verbo Funzione Avverbio')}/
+        "l" {return('Verbo Funzione Locuzione')}
+
+
+declinazione=[1|2|3|4|5] {switch(parseInt(text())){
+							case(1): return ' Prima declinazione';
+                            case(2): return ' Seconda declinazione';
+                            case(3): return ' Terza declinazione';
+                            case(4): return ' nd'
+                            case(5): return ' nd'}}
+                     
+genere=[f|m] {if (text()=='f') return ' Femminile'; else if (text()=='m') return ' Maschile';}
+
+numero=[s|p] {if (text()=='s') return ' Singolare'; else if (text()=='p') return ' Plurale';}
+
+grado="c+" {return('Grado c+ singolare')}/
+		"c-" {return('Grado c-')}/
+        "c=" {return('Grado c=')}
+
+Integer "integer"
+  = _ [0-9]+ { return parseInt(text(), 10); }
+
+_ "whitespace"= " "*
+
+`
+
+
+
 var testmm = 0
 
 //query