Skip to content

Commit

Permalink
Introduce new alignment token type
Browse files Browse the repository at this point in the history
- Update unit tests
- Update GitHub Actions workflow configuration, test on Go 1.22.x, and disable Go module cache
  • Loading branch information
xuri committed Mar 16, 2024
1 parent d98342a commit 5bacf1a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 33 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
go-version: [1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x]
os: [ubuntu-latest, macos-latest]
targetplatform: [x86, x64]

runs-on: ${{ matrix.os }}

steps:

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get dependencies
run: |
Expand All @@ -30,7 +34,9 @@ jobs:
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: coverage.txt
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2022-2023 Ri Xu All rights reserved.
Copyright (c) 2022-2024 Ri Xu All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
10 changes: 9 additions & 1 deletion nfp.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 - 2023 The nfp Authors. All rights reserved. Use of this
// Copyright 2022 - 2024 The nfp Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
//
Expand Down Expand Up @@ -55,6 +55,7 @@ const (
TokenSubTypeLanguageInfo = "LanguageInfo"
TokenTypeColor = "Color"
// Token types
TokenTypeAlignment = "Alignment"
TokenTypeCondition = "Condition"
TokenTypeCurrencyLanguage = "CurrencyLanguage"
TokenTypeDateTimes = "DateTimes"
Expand Down Expand Up @@ -443,6 +444,13 @@ func (ps *Parser) getTokens() Tokens {
}

if ps.currentChar() == Underscore {
if ps.nextChar() == ParenOpen || ps.nextChar() == ParenClose {
if ps.Token.TType != "" {
ps.Tokens.add(ps.Token.TValue, ps.Token.TType, ps.Token.Parts)
}
ps.Token.TValue = ps.nextChar()
ps.Token.TType = TokenTypeAlignment
}
ps.Offset += 2
continue
}
Expand Down
Loading

0 comments on commit 5bacf1a

Please sign in to comment.