Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions javalang/ast.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pickle

import six
import sys


class MetaNode(type):
Expand Down Expand Up @@ -29,7 +30,7 @@ def __init__(self, **kwargs):
setattr(self, attr_name, value)

if values:
raise ValueError('Extraneous arguments')
raise ValueError(f'Extraneous arguments: {values} not in {self.attrs}')

def __equals__(self, other):
if type(other) is not type(self):
Expand Down Expand Up @@ -59,7 +60,7 @@ def filter(self, pattern):
@property
def children(self):
return [getattr(self, attr_name) for attr_name in self.attrs]

@property
def position(self):
if hasattr(self, "_position"):
Expand Down
10 changes: 10 additions & 0 deletions javalang/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ def parse(s):
tokens = tokenize(s)
parser = Parser(tokens)
return parser.parse()

def parse_method_or_field_declaraction(s):
tokens = tokenize(s)
parser = Parser(tokens)
return parser.parse_method_or_field_declaraction()

def parse_member_declaration(s):
tokens = tokenize(s)
parser = Parser(tokens)
return parser.parse_member_declaration()
Loading