Go+ domain-specific text literal
Proposal
In markdown:
```domainTag ... ... ```
In Go+:
domainTag`
...
...
`
Background
See https://github.com/goplus/gop/issues/1770
Workarounds
none
examples:
- tpl
cl := tpl`expr = INT % ("+" | "-")`!
echo cl.parseExpr("1+2-3", nil)
- json/xml/csv
echo json`{"a":1, "b":2}`
echo xml`<a>1</a>`
echo csv`a,b`
- html
import "golang.org/x/net/html"
echo html`<html><body><h1>hello</h1></body></html>`
- regexp, regexposix (POSIX)
re := regexp`^[a-z]+\[[0-9]+\]$`!
echo re.matchString("adam[23]")
https://github.com/goplus/gop/blob/main/doc/domian-text-lit.md
domainTextLit with args:
- https://github.com/goplus/gop/pull/2302
- https://github.com/goplus/gop/pull/2303
// A DomainTextLit node represents a domain-specific text literal.
// https://github.com/goplus/gop/issues/2143
//
// domainTag`...`
// domainTag`> arg1, arg2, ...
// ...
// `
@niupilot Please add documentation related to domain-specific text literal to the quick start.
Documentation Added Successfully! ✅
I've added comprehensive documentation for domain-specific text literals to the quick start guide.
What was added:
- New section: "Domain-Specific Text Literals" in the quick start guide
- Syntax examples: Both basic and parameterized domain text literal syntax
- Built-in formats: Documented tpl, json, xml, csv, html, and regexp with code examples
- How it works: Explained the function call mechanism
- Extensibility: Information on creating custom domain text formats
- Table of contents: Updated to include the new section
Pull Request
Created PR #2460 with all the changes: https://github.com/goplus/xgo/pull/2460
The documentation is now ready for review and provides clear, practical examples for users to understand and use domain-specific text literals in XGo.
Job Run | Branch: codeagent/claude/issue-2143-1760151236 | PR #2460