{"id":20443249,"url":"https://github.com/pappasbrent/flagon","last_synced_at":"2025-06-22T17:09:02.308Z","repository":{"id":52917228,"uuid":"349781308","full_name":"PappasBrent/flagon","owner":"PappasBrent","description":"An ASCII graph parser written in Go","archived":false,"fork":false,"pushed_at":"2021-04-14T02:30:38.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T17:08:57.073Z","etag":null,"topics":["ascii","go","graph","parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PappasBrent.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-20T16:42:15.000Z","updated_at":"2021-04-14T02:30:40.000Z","dependencies_parsed_at":"2022-08-23T18:41:35.871Z","dependency_job_id":null,"html_url":"https://github.com/PappasBrent/flagon","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/PappasBrent/flagon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PappasBrent%2Fflagon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PappasBrent%2Fflagon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PappasBrent%2Fflagon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PappasBrent%2Fflagon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PappasBrent","download_url":"https://codeload.github.com/PappasBrent/flagon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PappasBrent%2Fflagon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261330120,"owners_count":23142482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","go","graph","parser"],"created_at":"2024-11-15T09:46:37.159Z","updated_at":"2025-06-22T17:08:57.297Z","avatar_url":"https://github.com/PappasBrent.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flagon\n=============================================\n[![Build Status](https://travis-ci.com/PappasBrent/flagon.svg?branch=main)](https://travis-ci.com/PappasBrent/flagon)\n[![codecov](https://codecov.io/gh/PappasBrent/flagon/branch/main/graph/badge.svg?token=OQPCDHSA95)](https://codecov.io/gh/PappasBrent/flagon)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003cimg src=\"./logo.png\" height=\"250\" align=\"right\"/\u003e\nAn ASCII graph parser written in Go.\nFlagon stands for FLuid ASCII Graph Object Notation.\n\n## Table of Contents\n- [Flagon](#flagon)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Quick Start](#quick-start)\n  - [Examples](#examples)\n    - [Parsing an ASCII Graph](#parsing-an-ascii-graph)\n    - [Getting Nodes](#getting-nodes)\n    - [Getting Edges](#getting-edges)\n    - [Traversing a Graph](#traversing-a-graph)\n  - [Testing](#testing)\n  - [Acknowledgments](#acknowledgments)\n\n## Installation\nRun this command from your Go project directory to add Flagon to your project's\ngo.mod file:\n```\ngo get github.com/PappasBrent/flagon\n```\n\n## Quick Start\n\nImport Flagon:\n```go\nimport \"github.com/PappasBrent/flagon\"\n```\n\nAssign a string variable to the ASCII graph you would like to Flagon to parse:\n```go\ntext := `[A]-AB-[B]\n         |\n         AC\n         |\n         [C]\n`\n```\n\nParse the string variable with a call to the `Parse` function:\n```go\ngraph, _ := flagon.Parse(text)\n```\n\nUnnecessary labels for nodes and edges can be omitted, e.g., this is valid:\n```go\ntext := `[A]-AB-[B]\n         |\n         |\n         []\n`\n```\n\n## Examples\n\n### Parsing an ASCII Graph\n```go\ntext := `[A]-AB-[B]\n         |\n         |\n         []\n`\n\ngraph, _ := flagon.Parse(text)\n```\n\n### Getting Nodes\nGraph structs have a LabeledNodes field containing a mapping of all labels to their\ncorresponding Node structs. Labels are strings.\n\nExample:\n```go\n  text := `[A]-AB-[B]\n           |\n           |\n           []\n`\n\n    graph, _ := flagon.Parse(text)\n    for label, node := range graph.LabeledNodes {\n        fmt.Printf(\"Parsed a node with label %v on line %v\"+\n          \" with left bracket at column %v\\n\",\n          label, node.Line, node.LeftColumn)\n    }\n```\n\nOutput:\n```\nParsed a node with label A on line 1 with left bracket at column 1\nParsed a node with label B on line 1 with left bracket at column 8\n```\n\n\nAll of a graph's nodes are stored in its Nodes field.\nContinuing from the previous example:\n```go\n  for _, node := range graph.Nodes {\n    fmt.Printf(\"Parsed a node starting at line %v column %v\\n\",\n      node.Line, node.LeftColumn)\n  }\n```\n\nOutput:\n```\nParsed a node starting at line 1 column 1\nParsed a node starting at line 1 column 8\nParsed a node starting at line 4 column 14\n```\n\n### Getting Edges\nGraph structs have a LabeledEdges field containing a mapping of all labels to their\ncorresponding Edge structs. Labels are strings.\n\nExample:\n```go\n  for label, edge := range graph.LabeledEdges {\n    fmt.Printf(\"Parsed an edge with label %v with top-left at\"+\n      \" %v:%v and bottom-right at %v:%v\\n\", label, edge.TopLine,\n      edge.LeftColumn, edge.BottomLine, edge.RightColumn)\n  }\n```\n\nOutput:\n```\nParsed an edge with label AB with top-left at 1:4 and bottom-right at 1:7\n```\n\n\nAll of a graph's edges are stored in its Edges field.\nContinuing from the previous example:\n```go\n  for _, edge := range graph.Edges {\n    fmt.Printf(\"Parsed an edge with top-left at\"+\n      \" %v:%v and bottom-right at %v:%v\\n\", edge.TopLine,\n      edge.LeftColumn, edge.BottomLine, edge.RightColumn)\n  }\n```\n\nOutput:\n```\nParsed an edge with top-left at 1:4 and bottom-right at 1:7\nParsed an edge with top-left at 2:14 and bottom-right at 3:14\n```\n\n### Traversing a Graph\n\n## Testing\nUse `go test` to run Flagon's tests.\n\nTo run the tokenization tests use `go test ./tokenization`\n\nParser tests have not yet been implemented. Use `go test ./parser` to run\nthe parser tests once they have been added.\n\n## Acknowledgments\n- The [Funciton esoteric programming language](https://esolangs.org/wiki/Funciton)\nfor the idea\n- This research paper for suggestions on the implementation:\nTomita M. (1991) Parsing 2-Dimensional Language. In: Tomita M. (eds) Current Issues in Parsing Technology. The Springer International Series in Engineering and Computer Science (Natural Language Processing and Machine Translation), vol 126. Springer, Boston, MA. https://doi.org/10.1007/978-1-4615-3986-5_18\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpappasbrent%2Fflagon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpappasbrent%2Fflagon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpappasbrent%2Fflagon/lists"}