Skip to content

Commit

Permalink
julefmt: update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed May 2, 2024
1 parent c66d622 commit 86c115b
Show file tree
Hide file tree
Showing 3 changed files with 703 additions and 704 deletions.
32 changes: 16 additions & 16 deletions src/comment.jule
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@ use std::jule::lex::{
TokenId,
}

struct Comment {
struct comment {
row: int
col: int
txt: str
}

struct CommentMap {
map: []&Comment
struct commentMap {
map: []&comment
}

impl CommentMap {
static fn build(mut &tokens: []&Token): CommentMap {
let mut cm = CommentMap{
map: make([]&Comment, 0, 1 << 8),
impl commentMap {
static fn build(mut &tokens: []&Token): commentMap {
let mut cm = commentMap{
map: make([]&comment, 0, 1 << 8),
}
let mut i = 0
for i < tokens.len {
let token = tokens[i]
if token.id != TokenId.Comment {
if token.Id != TokenId.Comment {
i++
continue
}
cm.map = append(cm.map, &Comment{
row: token.row,
col: token.column,
txt: token.kind,
cm.map = append(cm.map, &comment{
row: token.Row,
col: token.Column,
txt: token.Kind,
})
_ = copy(tokens[i:], tokens[i+1:])
tokens = tokens[:tokens.len-1]
}
ret cm
}

fn first(mut self, row: int): &Comment {
fn first(mut self, row: int): &comment {
if self.map.len == 0 {
ret nil
}
Expand All @@ -51,19 +51,19 @@ impl CommentMap {
ret c
}

fn drop_first(mut self) {
fn dropFirst(mut self) {
self.map = self.map[1:]
}

fn pop(mut self, row: int): &Comment {
fn pop(mut self, row: int): &comment {
if self.map.len == 0 {
ret nil
}
let mut c = self.map[0]
if c.row > row {
ret nil
}
self.drop_first()
self.dropFirst()
ret c
}
}
Loading

0 comments on commit 86c115b

Please sign in to comment.