Skip to content

Commit

Permalink
support comments (#8)
Browse files Browse the repository at this point in the history
* support comments
  • Loading branch information
DedAzaMarks authored Oct 16, 2023
1 parent bac324d commit 686b3af
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 224 deletions.
12 changes: 12 additions & 0 deletions internal/build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package build

import (
"encoding/binary"
"encoding/hex"
"flag"
"fmt"
"os"
Expand All @@ -21,6 +23,7 @@ var (
buildTimestamp string
machine string
commit string
commitTag uint32
commitTimestamp string
version string
number string
Expand Down Expand Up @@ -52,6 +55,11 @@ func Commit() string {
return commit
}

// appropriate for inserting into statshouse raw key
func CommitTag() uint32 {
return commitTag
}

// UNIX timestampt seconds, so stable in any TZ
func CommitTimestamp() uint32 {
return commitTimestampUint32
Expand Down Expand Up @@ -82,6 +90,10 @@ func init() {
ts, _ := strconv.ParseUint(commitTimestamp, 10, 32)
commitTimestampUint32 = uint32(ts)

if commitTagRaw, _ := hex.DecodeString(commit); len(commitTagRaw) >= 4 {
commitTag = binary.BigEndian.Uint32(commitTagRaw[:])
}

if buildTimestamp != "" {
ts, _ = strconv.ParseUint(buildTimestamp, 10, 32)
buildTimestampUint32 = uint32(ts)
Expand Down
6 changes: 6 additions & 0 deletions internal/tlast/tlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ type Field struct {

PR PositionRange
PRName PositionRange

CommentBefore string // comment before field
CommentRight string // comment to the right of field
}

type Combinator struct {
Expand All @@ -119,6 +122,9 @@ type Combinator struct {

TemplateArgumentsPR PositionRange // especially useful when 0 arguments
PR PositionRange

CommentBefore string // comment before combinator
CommentRight string // comment to the right of combinator
}

type TL []*Combinator
Expand Down
Loading

0 comments on commit 686b3af

Please sign in to comment.