Skip to content

Commit 8e6fd91

Browse files
authored
Add IVocabulary.getMaxTokenType (#4913)
Signed-off-by: Peter Townsend <[email protected]>
1 parent faa457a commit 8e6fd91

File tree

1 file changed

+62
-55
lines changed

1 file changed

+62
-55
lines changed

runtime/CSharp/src/IVocabulary.cs

Lines changed: 62 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,61 +20,68 @@ namespace Antlr4.Runtime
2020
/// <author>Sam Harwell</author>
2121
public interface IVocabulary
2222
{
23-
/// <summary>Gets the string literal associated with a token type.</summary>
24-
/// <remarks>
25-
/// Gets the string literal associated with a token type. The string returned
26-
/// by this method, when not
27-
/// <see langword="null"/>
28-
/// , can be used unaltered in a parser
29-
/// grammar to represent this token type.
30-
/// <p>The following table shows examples of lexer rules and the literal
31-
/// names assigned to the corresponding token types.</p>
32-
/// <table>
33-
/// <tr>
34-
/// <th>Rule</th>
35-
/// <th>Literal Name</th>
36-
/// <th>Java String Literal</th>
37-
/// </tr>
38-
/// <tr>
39-
/// <td>
40-
/// <c>THIS : 'this';</c>
41-
/// </td>
42-
/// <td>
43-
/// <c>'this'</c>
44-
/// </td>
45-
/// <td>
46-
/// <c>"'this'"</c>
47-
/// </td>
48-
/// </tr>
49-
/// <tr>
50-
/// <td>
51-
/// <c>SQUOTE : '\'';</c>
52-
/// </td>
53-
/// <td>
54-
/// <c>'\''</c>
55-
/// </td>
56-
/// <td>
57-
/// <c>"'\\''"</c>
58-
/// </td>
59-
/// </tr>
60-
/// <tr>
61-
/// <td>
62-
/// <c>ID : [A-Z]+;</c>
63-
/// </td>
64-
/// <td>n/a</td>
65-
/// <td>
66-
/// <see langword="null"/>
67-
/// </td>
68-
/// </tr>
69-
/// </table>
70-
/// </remarks>
71-
/// <param name="tokenType">The token type.</param>
72-
/// <returns>
73-
/// The string literal associated with the specified token type, or
74-
/// <see langword="null"/>
75-
/// if no string literal is associated with the type.
76-
/// </returns>
77-
[return: Nullable]
23+
24+
/// <summary>
25+
/// Returns the highest token type value. It can be used to iterate from
26+
/// zero to that number, inclusively, thus querying all stored entries.
27+
/// </summary>
28+
int getMaxTokenType();
29+
30+
/// <summary>Gets the string literal associated with a token type.</summary>
31+
/// <remarks>
32+
/// Gets the string literal associated with a token type. The string returned
33+
/// by this method, when not
34+
/// <see langword="null"/>
35+
/// , can be used unaltered in a parser
36+
/// grammar to represent this token type.
37+
/// <p>The following table shows examples of lexer rules and the literal
38+
/// names assigned to the corresponding token types.</p>
39+
/// <table>
40+
/// <tr>
41+
/// <th>Rule</th>
42+
/// <th>Literal Name</th>
43+
/// <th>Java String Literal</th>
44+
/// </tr>
45+
/// <tr>
46+
/// <td>
47+
/// <c>THIS : 'this';</c>
48+
/// </td>
49+
/// <td>
50+
/// <c>'this'</c>
51+
/// </td>
52+
/// <td>
53+
/// <c>"'this'"</c>
54+
/// </td>
55+
/// </tr>
56+
/// <tr>
57+
/// <td>
58+
/// <c>SQUOTE : '\'';</c>
59+
/// </td>
60+
/// <td>
61+
/// <c>'\''</c>
62+
/// </td>
63+
/// <td>
64+
/// <c>"'\\''"</c>
65+
/// </td>
66+
/// </tr>
67+
/// <tr>
68+
/// <td>
69+
/// <c>ID : [A-Z]+;</c>
70+
/// </td>
71+
/// <td>n/a</td>
72+
/// <td>
73+
/// <see langword="null"/>
74+
/// </td>
75+
/// </tr>
76+
/// </table>
77+
/// </remarks>
78+
/// <param name="tokenType">The token type.</param>
79+
/// <returns>
80+
/// The string literal associated with the specified token type, or
81+
/// <see langword="null"/>
82+
/// if no string literal is associated with the type.
83+
/// </returns>
84+
[return: Nullable]
7885
string GetLiteralName(int tokenType);
7986

8087
/// <summary>Gets the symbolic name associated with a token type.</summary>

0 commit comments

Comments
 (0)