add C-style comment support

This commit is contained in:
2020-11-03 11:20:24 +03:00
parent f083dcd3d8
commit 69be8312f8
27 changed files with 56 additions and 45 deletions

View File

@ -1,8 +1,8 @@
package main
import (
"multini/output"
"multini/types"
"multini/internal/output"
"multini/internal/types"
)
func chk() int {

View File

@ -4,8 +4,8 @@ import (
"errors"
"os"
"multini/output"
"multini/types"
"multini/internal/output"
"multini/internal/types"
"github.com/juju/gnuflag"
)

View File

@ -3,8 +3,8 @@ package main
import (
"os"
"multini/output"
"multini/types"
"multini/internal/output"
"multini/internal/types"
)
const (

View File

@ -7,8 +7,8 @@ import (
"regexp"
"strings"
"multini/output"
"multini/types"
"multini/internal/output"
"multini/internal/types"
)
var (
@ -26,15 +26,15 @@ var (
RxBodyPrefix string = `(?P<` + NgPrefix + `>\s+)?`
RxSectionName string = `\[(?P<` + NgSection + `>.+)\]`
RxKey string = `(?P<` + NgKey + `>(?:[^;#=]+[^\s=;#]|[^;#=]))?`
RxKey string = `(?P<` + NgKey + `>(?:[^;#/=]+[^\s=;#/]|[^;#/=]))?`
RxKeyPostfix string = `(?P<` + NgKeyPostfix + `>\s+)?`
RxValuePrefix string = `(?P<` + NgValuePrefix + `>\s+)?`
RxValue string = `(?P<` + NgValue + `>(?:[^;#]+[^\s;#]|[^;#]))?`
RxValue string = `(?P<` + NgValue + `>(?:[^;#/]+[^\s;#/]|[^;#/]))?`
RxValuePostfix string = `(?P<` + NgValuePostfix + `>\s+)?`
RxKeyVal string = RxKey + RxKeyPostfix + `=` + RxValuePrefix + RxValue + RxValuePostfix
RxBody string = `(?:` + RxSectionName + `|` + RxKeyVal + `)?`
RxBodyPostfix string = `(?P<` + NgPostifx + `>\s+)?`
RxCommentPrefix string = `(?P<` + NgCommentPrefix + `>[#;]\s*)`
RxCommentPrefix string = `(?P<` + NgCommentPrefix + `>([#;]|//)\s*)`
RxCommentText string = `(?P<` + NgComment + `>.+)?`
RxComment string = `(?:` + RxCommentPrefix + RxCommentText + `)?`
Rx string = RxBodyPrefix + RxBody + RxBodyPostfix + RxComment

View File

@ -7,7 +7,7 @@ import (
"os"
"path/filepath"
"multini/types"
"multini/internal/types"
)
// Source: https://gist.github.com/var23rav/23ae5d0d4d830aff886c3c970b8f6c6b