GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adds better support for nested parenthesis. See issue #2. · datagram-db/java2python@ad5b3fe

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • java2python/compiler
    • visitor.py
  • test
    • Expr2.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎java2python/compiler/visitor.py‎

Copy file name to clipboardExpand all lines: java2python/compiler/visitor.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,19 @@ def acceptMethodCall(self, node, memo):
774774
arg.left.walk(child, memo)
775775
arg.right = arg = expr(parent=self)
776776

777+
skipParensParents = (
778+
tokens.IF,
779+
tokens.WHILE,
780+
tokens.SWITCH,
781+
tokens.SYNCHRONIZED,
782+
)
783+
784+
def acceptParentesizedExpr(self, node, memo):
785+
if node.parent.type not in self.skipParensParents:
786+
right = self.pushRight()
787+
right.fs = '(' + FS.lr + ')'
788+
return right
789+
return self
777790

778791
def acceptThisConstructorCall(self, node, memo):
779792
""" Accept and process a 'this(...)' constructor call. """
Collapse file

‎test/Expr2.java‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Expr2 {
2+
public static void main(String[] args) {
3+
int a = 1;
4+
int b = 2;
5+
int c = 3;
6+
int radius = 4;
7+
int y = (radius*radius*a*(a + radius)*radius*b*b) / (c*c+a*a+b*b);
8+
System.out.println(y);
9+
10+
}
11+
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.