mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
d: style changes
* data/skeletons/lalr1.d: here. * examples/d/calc.y: Remove incorrect support for decimal numbers. Formatting changes.
This commit is contained in:
@@ -18,8 +18,7 @@
|
|||||||
m4_include(b4_skeletonsdir/[d.m4])
|
m4_include(b4_skeletonsdir/[d.m4])
|
||||||
|
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
b4_output_begin([b4_parser_file_name])
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
|
||||||
[2007-2012, 2019])
|
[2007-2012, 2019])
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ b4_locations_if([, ref ]b4_location_type[ loc])[)
|
|||||||
{
|
{
|
||||||
stream.write ("Stack now");
|
stream.write ("Stack now");
|
||||||
for (int i = 0; i < stack.length; i++)
|
for (int i = 0; i < stack.length; i++)
|
||||||
stream.write (" %d", stack[i].state);
|
stream.write (" ", stack[i].state);
|
||||||
stream.writeln ();
|
stream.writeln ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +154,7 @@ public struct ]b4_position_type[ {
|
|||||||
public string filename = "(unspecified file)";
|
public string filename = "(unspecified file)";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a string representation of the position. */
|
* A string representation of the position. */
|
||||||
public string toString() const {
|
public string toString() const {
|
||||||
return format("%s:%d.%d", filename, line, column);
|
return format("%s:%d.%d", filename, line, column);
|
||||||
}
|
}
|
||||||
@@ -207,7 +206,7 @@ public class ]b4_location_type[
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a representation of the location. For this to be correct,
|
* A representation of the location. For this to be correct,
|
||||||
* <code>]b4_position_type[</code> should override the <code>toString</code>
|
* <code>]b4_position_type[</code> should override the <code>toString</code>
|
||||||
* method. */
|
* method. */
|
||||||
public const string toString () const {
|
public const string toString () const {
|
||||||
@@ -283,7 +282,7 @@ b4_user_union_members
|
|||||||
private File yyDebugStream;
|
private File yyDebugStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the <tt>File</tt> on which the debugging output is
|
* The <tt>File</tt> on which the debugging output is
|
||||||
* printed.
|
* printed.
|
||||||
*/
|
*/
|
||||||
public File getDebugStream () { return yyDebugStream; }
|
public File getDebugStream () { return yyDebugStream; }
|
||||||
@@ -349,7 +348,7 @@ b4_user_union_members
|
|||||||
private int yyerrstatus_ = 0;
|
private int yyerrstatus_ = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether error recovery is being done. In this state, the parser
|
* Whether error recovery is being done. In this state, the parser
|
||||||
* reads token until it reaches a known state, and then restarts normal
|
* reads token until it reaches a known state, and then restarts normal
|
||||||
* operation. */
|
* operation. */
|
||||||
public final bool recovering ()
|
public final bool recovering ()
|
||||||
@@ -447,7 +446,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|||||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
||||||
~ yylocationp.toString() ~ ": "])[;
|
~ yylocationp.toString() ~ ": "])[;
|
||||||
static if (__traits(compiles, message~=yyvaluep.toString ()))
|
static if (__traits(compiles, message ~= yyvaluep.toString ()))
|
||||||
message ~= yyvaluep.toString ();
|
message ~= yyvaluep.toString ();
|
||||||
else
|
else
|
||||||
message ~= format ("%s", &yyvaluep);
|
message ~= format ("%s", &yyvaluep);
|
||||||
@@ -893,4 +892,4 @@ b4_percent_code_get[]dnl
|
|||||||
|
|
||||||
}
|
}
|
||||||
b4_epilogue[]dnl
|
b4_epilogue[]dnl
|
||||||
m4_divert_pop(0)dnl
|
b4_output_end
|
||||||
|
|||||||
@@ -102,16 +102,14 @@ class CalcLexer(R) : Lexer
|
|||||||
|
|
||||||
// Skip initial spaces
|
// Skip initial spaces
|
||||||
while (!input.empty && input.front != '\n' && isWhite (input.front))
|
while (!input.empty && input.front != '\n' && isWhite (input.front))
|
||||||
{
|
|
||||||
input.popFront;
|
input.popFront;
|
||||||
}
|
|
||||||
|
|
||||||
// Handle EOF.
|
// Handle EOF.
|
||||||
if (input.empty)
|
if (input.empty)
|
||||||
return YYTokenType.EOF;
|
return YYTokenType.EOF;
|
||||||
|
|
||||||
// Numbers.
|
// Numbers.
|
||||||
if (input.front == '.' || input.front.isNumber)
|
if (input.front.isNumber)
|
||||||
{
|
{
|
||||||
import std.conv : parse;
|
import std.conv : parse;
|
||||||
semanticVal_.ival = input.parse!int;
|
semanticVal_.ival = input.parse!int;
|
||||||
|
|||||||
Reference in New Issue
Block a user