Move public types to the top
This commit is contained in:
parent
779ba052c1
commit
e0e5e87338
@ -1,14 +1,27 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file is generated by Propane.
|
||||
*/
|
||||
|
||||
<% if @grammar.modulename %>
|
||||
module <%= @grammar.modulename %>;
|
||||
|
||||
<% end %>
|
||||
|
||||
import std.stdio;
|
||||
|
||||
/**************************************************************************
|
||||
* User code blocks
|
||||
*************************************************************************/
|
||||
|
||||
<% @grammar.code_blocks.each do |code| %>
|
||||
<%= code %>
|
||||
<% end %>
|
||||
|
||||
/**************************************************************************
|
||||
* Public types
|
||||
*************************************************************************/
|
||||
|
||||
/* Result codes. */
|
||||
public enum : size_t
|
||||
{
|
||||
@ -20,9 +33,6 @@ public enum : size_t
|
||||
P_EOF,
|
||||
}
|
||||
|
||||
/* An invalid ID value. */
|
||||
private enum size_t INVALID_ID = cast(size_t)-1;
|
||||
|
||||
/** Token ID type. */
|
||||
public alias Token = <%= get_type_for(@grammar.invalid_token_id) %>;
|
||||
|
||||
@ -38,13 +48,6 @@ public enum : Token
|
||||
INVALID_TOKEN_ID = <%= @grammar.invalid_token_id %>,
|
||||
}
|
||||
|
||||
/** Token names. */
|
||||
public static immutable string[] token_names = [
|
||||
<% @grammar.tokens.each_with_index do |token, index| %>
|
||||
"<%= token.name %>",
|
||||
<% end %>
|
||||
];
|
||||
|
||||
/** Code point type. */
|
||||
public alias CodePoint = uint;
|
||||
|
||||
@ -70,6 +73,42 @@ public static struct Position
|
||||
uint col;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lexed token information.
|
||||
*/
|
||||
public static struct TokenInfo
|
||||
{
|
||||
/** Text position where the token was found. */
|
||||
Position position;
|
||||
|
||||
/** Number of input bytes used by the token. */
|
||||
size_t length;
|
||||
|
||||
/** Token identifier. */
|
||||
Token token;
|
||||
|
||||
/** Parser value associated with the token. */
|
||||
ParserValue pvalue;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Public data
|
||||
*************************************************************************/
|
||||
|
||||
/** Token names. */
|
||||
public static immutable string[] token_names = [
|
||||
<% @grammar.tokens.each_with_index do |token, index| %>
|
||||
"<%= token.name %>",
|
||||
<% end %>
|
||||
];
|
||||
|
||||
/**************************************************************************
|
||||
* Private types
|
||||
*************************************************************************/
|
||||
|
||||
/* An invalid ID value. */
|
||||
private enum size_t INVALID_ID = cast(size_t)-1;
|
||||
|
||||
/**************************************************************************
|
||||
* Decoder
|
||||
*************************************************************************/
|
||||
@ -216,14 +255,6 @@ private static immutable Mode[] modes = [
|
||||
<% end %>
|
||||
];
|
||||
|
||||
public static struct TokenInfo
|
||||
{
|
||||
Position position;
|
||||
size_t length;
|
||||
Token token;
|
||||
ParserValue pvalue;
|
||||
}
|
||||
|
||||
public static class Lexer
|
||||
{
|
||||
private string m_input;
|
||||
@ -349,7 +380,7 @@ public static class Lexer
|
||||
}
|
||||
}
|
||||
|
||||
struct MatchInfo
|
||||
private struct MatchInfo
|
||||
{
|
||||
size_t length;
|
||||
Position delta_position;
|
||||
|
Loading…
x
Reference in New Issue
Block a user