redo manuel and add caracters

This commit is contained in:
tuvu
2025-02-14 14:14:01 +01:00
parent 8881e17495
commit 2dfcd38fed
5 changed files with 17 additions and 8 deletions

View File

@@ -27,5 +27,4 @@ G: '"'
fragment WS: (' ' | '\n' | '\t' | '\r' | '\u000C');
WSS: WS+ { skip(); };
ID: ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')*;
STRING: ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|' '|'-'|'é'|'è'|'&')+;
//STRING: '"'(~('"'))+'"';
STRING: ('a'..'z'|'A'..'Z'|'\u00C0'..'\u00FF')('a'..'z'|'A'..'Z'|'0'..'9'|'\u00C0'..'\u00FF'|'_'|'-'|'&'|' ')* ;

View File

@@ -7,6 +7,7 @@ public class ASD_Turtle implements TurtleASD {
sealed interface Phrase{}
sealed interface Affectation{}
sealed interface Complement{}
sealed interface Text{}
sealed interface Entity{}
record TurtleImp(List<PhraseImp> phrases) implements Turtle{
@@ -48,9 +49,19 @@ public class ASD_Turtle implements TurtleASD {
return " <" + this.entity.toString() + ">";
}
}
record Complement_TextImp(String string) implements Complement{
record Complement_TextImp(Text text) implements Complement{
public String toString(){
return " \"" + this.string + "\"";
return " \"" + text.toString() + "\"";
}
}
record TextSTRImp(String string) implements Text{
public String toString(){
return this.string;
}
}
record TextImp(Entity entity) implements Text{
public String toString(){
return entity.toString();
}
}
record EntityImp(String string) implements Entity{

View File

@@ -30,7 +30,8 @@ public class Main {
//titre
EntityImp titre = new EntityImp("titre");
Complement_TextImp compilation = new Complement_TextImp("Compilation");
TextSTRImp text_compilation=new TextSTRImp("Compilation");
Complement_TextImp compilation = new Complement_TextImp(text_compilation);
AffectationImp aff2 = new AffectationImp(titre, List.of(compilation));
//auteur

View File

@@ -52,12 +52,10 @@ public class TurtleAST {
public void addSujet(String sujet){
this.currentSujet=sujet;
System.out.println("debug : sujet = " + sujet);
}
public void addVerbe(String verbe){
this.currentVerbe=verbe;
System.out.println("debug : verbe = " + verbe);
}
public void addComplement(String complement, Boolean isText){
@@ -66,7 +64,6 @@ public class TurtleAST {
EntityImp c = new EntityImp(complement, isText);
PhraseImp phrase = new PhraseImp(s,v,c);
this.listPhrases.add(phrase);
System.out.println("debug : complement = " + complement);
}

1
tests/test2_copy.ttl Executable file
View File

@@ -0,0 +1 @@
<m1info> <type> "M1".