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:
Adela Vais
2020-10-26 22:59:50 +02:00
committed by Akim Demaille
parent 5a31cda4c3
commit 4252134ba4
2 changed files with 22 additions and 22 deletions

View File

@@ -72,12 +72,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;
@@ -89,7 +89,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;
@@ -109,17 +109,17 @@ class CalcLexer(R) : Lexer
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))
{
start = end;
end.column++;
@@ -180,10 +180,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;
}

View File

@@ -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;
}