From 4252134ba407f8dd13e15fcb55fc5dd64b30c4ee Mon Sep 17 00:00:00 2001 From: Adela Vais Date: Mon, 26 Oct 2020 22:59:50 +0200 Subject: [PATCH] d: examples: fix coding style * examples/d/calc/calc.y, examples/d/simple/calc.y: Fix whitespace issues and remove the @property attribute. --- examples/d/calc/calc.y | 20 ++++++++++---------- examples/d/simple/calc.y | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/d/calc/calc.y b/examples/d/calc/calc.y index 98ec06c0..c3a0e9fd 100644 --- a/examples/d/calc/calc.y +++ b/examples/d/calc/calc.y @@ -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; } diff --git a/examples/d/simple/calc.y b/examples/d/simple/calc.y index 41800080..4cb07ca6 100644 --- a/examples/d/simple/calc.y +++ b/examples/d/simple/calc.y @@ -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; }