bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for Dlang support] d: examples: fix coding style


From: Adela Vais
Subject: [PATCH for Dlang support] d: examples: fix coding style
Date: Fri, 6 Nov 2020 17:52:25 +0200

Fixed whitespace issues and removed the @property attribute.

* examples/d/calc/calc.y, examples/d/simple/calc.y: Here.
---
 examples/d/calc/calc.y   | 22 +++++++++++-----------
 examples/d/simple/calc.y | 26 +++++++++++++-------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/examples/d/calc/calc.y b/examples/d/calc/calc.y
index 9fea82cd..89ed4006 100644
--- a/examples/d/calc/calc.y
+++ b/examples/d/calc/calc.y
@@ -52,7 +52,7 @@ input:
 
 line:
   EOL
-| exp EOL           { writeln ($exp); }
+| exp EOL           { writeln($exp); }
 | error EOL
 ;
 
@@ -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 0f441431..daf1fe72 100644
--- a/examples/d/simple/calc.y
+++ b/examples/d/simple/calc.y
@@ -50,7 +50,7 @@ input:
 
 line:
   EOL
-| exp EOL           { writeln ($exp); }
+| exp EOL           { writeln($exp); }
 | error EOL
 ;
 
@@ -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;
 }
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]