~dricottone/digestion

db7d0c4d6769d65070e6b68056cd035e4e31d339 — Dominic Ricottone 2 years ago 8cc8301 dev
Adding parcels

URLs are now parsed and separated out, into a secondary block of text.
2 files changed, 16 insertions(+), 3 deletions(-)

M go.mod
M main.go
M go.mod => go.mod +4 -1
@@ 2,4 2,7 @@ module git.dominic-ricottone.com/~dricottone/digestion

go 1.19

require git.dominic-ricottone.com/~dricottone/textwrap v0.0.3
require (
	git.dominic-ricottone.com/~dricottone/parcels v1.1.1
	git.dominic-ricottone.com/~dricottone/textwrap v0.0.3
)

M main.go => main.go +12 -2
@@ 10,6 10,7 @@ import (
	"flag"

	"git.dominic-ricottone.com/~dricottone/digestion/message"
	parcels "git.dominic-ricottone.com/~dricottone/parcels/common"
)

const LINE_LENGTH = 80


@@ 35,8 36,15 @@ func first_submatch(r regexp.Regexp, s string) string {
}

func parse_stream(reader io.Reader, length int) {
	// Create scanner from reader
	input := bufio.NewScanner(reader)
	fmt.Println("ping")
	content, urls, err := parcels.ParseFromReader(reader, 0)
	if err != nil {
		fmt.Printf("internal error - %v\n", err)
		os.Exit(1)
	}

	// create scanner
	input := bufio.NewScanner(strings.NewReader(content))

	// Compile regular expressions
	re_message_break, err := regexp.Compile("^-{5,}$")


@@ 99,6 107,8 @@ func parse_stream(reader io.Reader, length int) {
		}
	}

	fmt.Printf("%s", urls)

	// Check for scanner errors
	if err = input.Err(); err != nil {
		fmt.Printf("internal error - %v\n", err)