Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go+ domain-specific text #2143

Open
xushiwei opened this issue Mar 1, 2025 · 1 comment
Open

Go+ domain-specific text #2143

xushiwei opened this issue Mar 1, 2025 · 1 comment

Comments

@xushiwei
Copy link
Member

xushiwei commented Mar 1, 2025

Proposal

In markdown:

```domainTag
...
...
```

In Go+:

domainTag`
...
...
`

Background

See #1770

Workarounds

none

xushiwei added a commit to xushiwei/gop that referenced this issue Mar 1, 2025
xushiwei added a commit that referenced this issue Mar 1, 2025
#2143 gop/parser: ast.DomainTextLit
xushiwei added a commit to xushiwei/gop that referenced this issue Mar 1, 2025
xushiwei added a commit that referenced this issue Mar 1, 2025
#2143 gop/cl: compileDomainTextLit
xushiwei added a commit to xushiwei/gop that referenced this issue Mar 5, 2025
xushiwei added a commit that referenced this issue Mar 5, 2025
#2143 domain-specific text: tpl, html, xml, json, csv
@xushiwei
Copy link
Member Author

xushiwei commented Mar 5, 2025

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]")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant