class KotlinParser

Defined in:

miniparsers/kotlin.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(path : String, tokens : Array(Token)) #

Initialize the parser with the path and tokens


[View source]

Macro Detail

macro reset_fields #

Macro to reset field variables


[View source]
macro skip_constructor #

Macro to skip constructor keyword in tokens


[View source]
macro skip_modifier_list #

Macro to skip modifier list in tokens


[View source]
macro skip_newline #

Macro to skip newlines in tokens


[View source]
macro skip_primary_constructor #

Macro to skip primary constructor in tokens


[View source]
macro skip_type_parameters #

Macro to skip type parameters in tokens


[View source]

Instance Method Detail

def annotation_start?(annotation_name) #

Check if a token value indicates the start of an annotation


[View source]
def classes : Array(ClassModel) #

[View source]
def classes=(classes : Array(ClassModel)) #

[View source]
def classes_tokens : Array(Array(Token)) #

[View source]
def classes_tokens=(classes_tokens : Array(Array(Token))) #

[View source]
def find_annotation_end(start_index) #

Find the end of an annotation


[View source]
def find_annotation_start(end_index) #

Find the start of an annotation


[View source]
def find_bracket_partner(param_start_index : Int32) #

Find the matching bracket for a given token index


[View source]
def get_class_name(tokens : Array(Token)) #

Get the class name from a set of tokens


[View source]
def get_package_name(tokens : Array(Token)) #

Method to extract the package name from the tokens


[View source]
def get_root_source_directory(path : String, package_name : String) #

Method to determine the root source directory based on the package name


[View source]
def import_statements : Array(String) #

[View source]
def import_statements=(import_statements : Array(String)) #

[View source]
def modifier?(token) #

Check if a token is a valid modifier


[View source]
def parse #

Main parse method to handle import statements and classes


[View source]
def parse_annotations_backwards(backward_index) #

Parse annotations backwards from a given index


[View source]
def parse_class_modifiers(class_name_index) #

Parse modifiers for a class starting from a given index


[View source]
def parse_class_parameters(class_start_index) #

Parse class parameters from the tokens


[View source]
def parse_classes(tokens : Array(Token), index = 0) #

Parse class declarations from the tokens


[View source]
def parse_fields_from_class_body(class_start_index, fields : Hash(String, FieldModel), methods : Hash(String, MethodModel)) #

Parse fields from the class body


[View source]
def parse_formal_parameters(param_start_index : Int32) #

Parse the formal parameters of a method or constructor


[View source]
def parse_import_statements(tokens : Array(Token)) #

Parse import statements from the tokens


[View source]
def parse_methods(class_tokens : Array(Token)) #

Parse methods from the class tokens


[View source]
def path : String #

[View source]
def path=(path : String) #

[View source]
def print_tokens(tokens : Array(Token), id = "default", trace = false) #

Print tokens for debugging purposes


[View source]
def tokens : Array(Token) #

[View source]
def tokens=(tokens : Array(Token)) #

[View source]
def trace #

Trace parsed class and method details


[View source]