Package: libopentoken6.1-dev
Version: 6.0b-7
Severity: normal
Dear Maintainer,
Java Annotation, that is identifier starting with @, are not processed
by the current Java_Lexer.
Here is an exemple of Java code :
/**
* Test class for {@link PetTypeFormatter}
*
* @author Colin But
*/
@RunWith(MockitoJUnitRunner.class)
public class PetTypeFormatterTests {
@Mock
private PetRepository pets;
private PetTypeFormatter petTypeFormatter;
@Before
public void setup() {
this.petTypeFormatter = new PetTypeFormatter(pets);
}
...
}
The Java lexer do not recognize @ character in code.
It's Ok in comments, and so no problem with Javadoc tags, but it raises
an OpenToken.Syntax_Error exception when met in code.
So, annotations like @Override cause the analysis interruption.
I added a new Annotation_T token to the Java lexer, the patch file is
joined.
(note that the last part of the patch is my proposal for bug Bug#886507,
that is the buffer increase).
Best regards,
--
-- Lionel
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.14.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8),
LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libopentoken6.1-dev depends on:
ii gnat 7
ii gnat-7 7.2.0-18
ii libopentoken9.1 6.0b-7
libopentoken6.1-dev recommends no packages.
Versions of packages libopentoken6.1-dev suggests:
ii libopentoken-doc 6.0b-7
-- no debconf information
--- /usr/share/ada/adainclude/opentoken/java_lexer.ads 2017-08-09 20:52:16.000000000 +0200
+++ Patch/java_lexer.ads 2018-01-09 22:39:53.919915391 +0100
@@ -40,6 +40,7 @@
with OpenToken.Recognizer.Separator;
with OpenToken.Recognizer.String;
with OpenToken.Token.Enumerated.Analyzer;
+
package Java_Lexer is
---------------------------------------------------------------------
@@ -116,6 +117,7 @@
String_T, -- "Any characters except " or \ and escape sequences"
-- Other tokens
Identifier_T,
+ Annotation_T,
EndOfLineComment_T, -- // to end of line
EmbeddedComment_T, -- /* anything (even several lines) */
Whitespace_T,
@@ -239,6 +241,10 @@
(Allow_Underscores => False,
Allow_Signs => False,
Allow_Laziness => True)),
+ Annotation_T => Tokenizer.Get
+ (OpenToken.Recognizer.Identifier.Get
+ (Start_Chars => Ada.Strings.Maps.To_Set ('@'),
+ Body_Chars => Ada.Strings.Maps.Constants.Alphanumeric_Set)),
Identifier_T => Tokenizer.Get
(OpenToken.Recognizer.Identifier.Get
(Start_Chars => Ada.Strings.Maps.Constants.Letter_Set,
@@ -260,6 +266,7 @@
(OpenToken.Recognizer.Character_Set.Get (OpenToken.Recognizer.Character_Set.Standard_Whitespace)),
End_of_File_T => Tokenizer.Get (OpenToken.Recognizer.End_Of_File.Get));
- Analyzer : constant Tokenizer.Handle := Tokenizer.Initialize (Syntax);
+ Analyzer : constant Tokenizer.Handle := Tokenizer.Initialize (Syntax,
+ Buffer_Size => 8192);
end Java_Lexer;