-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomment.go
More file actions
35 lines (30 loc) · 944 Bytes
/
comment.go
File metadata and controls
35 lines (30 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package gcode
import "fmt"
// CommentForm distinguishes the syntactic form of a G-code comment
// for round-trip fidelity.
type CommentForm int
const (
// CommentSemicolon represents a semicolon-delimited comment (; text).
CommentSemicolon CommentForm = iota
// CommentParenthesis represents a parenthesis-delimited comment ((text)).
CommentParenthesis
)
// String returns the human-readable name of the comment form.
func (f CommentForm) String() string {
switch f {
case CommentSemicolon:
return "semicolon"
case CommentParenthesis:
return "parenthesis"
default:
return fmt.Sprintf("CommentForm(%d)", int(f))
}
}
// Comment carries the raw comment text (without delimiter characters).
// The Form field distinguishes ; vs (...) syntax for round-trip fidelity.
type Comment struct {
// Text is the comment content without delimiters.
Text string
// Form indicates the syntactic style of the comment.
Form CommentForm
}