mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
d: examples: fix coding style
* examples/d/calc/calc.y, examples/d/simple/calc.y: Fix whitespace issues and remove the @property attribute.
This commit is contained in:
committed by
Akim Demaille
parent
5a31cda4c3
commit
4252134ba4
@@ -70,12 +70,12 @@ import std.range.primitives;
|
||||
import std.stdio;
|
||||
|
||||
auto calcLexer(R)(R range)
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
if (isInputRange!R && is(ElementType!R : dchar))
|
||||
{
|
||||
return new CalcLexer!R(range);
|
||||
}
|
||||
|
||||
auto calcLexer (File f)
|
||||
auto calcLexer(File f)
|
||||
{
|
||||
import std.algorithm : map, joiner;
|
||||
import std.utf : byDchar;
|
||||
@@ -87,7 +87,7 @@ auto calcLexer (File f)
|
||||
}
|
||||
|
||||
class CalcLexer(R) : Lexer
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
if (isInputRange!R && is(ElementType!R : dchar))
|
||||
{
|
||||
R input;
|
||||
|
||||
@@ -96,25 +96,25 @@ class CalcLexer(R) : Lexer
|
||||
// Should be a local in main, shared with %parse-param.
|
||||
int exit_status = 0;
|
||||
|
||||
public void yyerror (string s)
|
||||
public void yyerror(string s)
|
||||
{
|
||||
exit_status = 1;
|
||||
stderr.writeln (s);
|
||||
stderr.writeln(s);
|
||||
}
|
||||
|
||||
YYSemanticType semanticVal_;
|
||||
|
||||
public final @property YYSemanticType semanticVal ()
|
||||
public final YYSemanticType semanticVal()
|
||||
{
|
||||
return semanticVal_;
|
||||
}
|
||||
|
||||
TokenKind yylex ()
|
||||
TokenKind yylex()
|
||||
{
|
||||
import std.uni : isWhite, isNumber;
|
||||
|
||||
// Skip initial spaces
|
||||
while (!input.empty && input.front != '\n' && isWhite (input.front))
|
||||
while (!input.empty && input.front != '\n' && isWhite(input.front))
|
||||
input.popFront;
|
||||
|
||||
if (input.empty)
|
||||
@@ -145,10 +145,10 @@ class CalcLexer(R) : Lexer
|
||||
}
|
||||
}
|
||||
|
||||
int main ()
|
||||
int main()
|
||||
{
|
||||
auto l = calcLexer (stdin);
|
||||
auto p = new Calc (l);
|
||||
p.parse ();
|
||||
auto l = calcLexer(stdin);
|
||||
auto p = new Calc(l);
|
||||
p.parse();
|
||||
return l.exit_status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user