Lines Matching refs:n
48 func (n *ninjaWriter) Comment(comment string) error {
49 n.justDidBlankLine = false
79 _, err := n.writer.WriteString(line)
89 _, err := n.writer.WriteString("# ")
93 _, err = n.writer.WriteString(line)
97 _, err = n.writer.WriteString("\n")
106 func (n *ninjaWriter) Pool(name string) error {
107 n.justDidBlankLine = false
108 return n.writeStatement("pool", name)
111 func (n *ninjaWriter) Rule(name string) error {
112 n.justDidBlankLine = false
113 return n.writeStatement("rule", name)
116 func (n *ninjaWriter) Build(comment string, rule string, outputs, implicitOuts,
120 n.justDidBlankLine = false
126 ninjaWriter: n,
192 func (n *ninjaWriter) Assign(name, value string) error {
193 n.justDidBlankLine = false
194 _, err := n.writer.WriteString(name)
198 _, err = n.writer.WriteString(" = ")
202 _, err = n.writer.WriteString(value)
206 _, err = n.writer.WriteString("\n")
213 func (n *ninjaWriter) ScopedAssign(name, value string) error {
214 n.justDidBlankLine = false
215 _, err := n.writer.WriteString(indentString[:indentWidth])
219 _, err = n.writer.WriteString(name)
223 _, err = n.writer.WriteString(" = ")
227 _, err = n.writer.WriteString(value)
231 _, err = n.writer.WriteString("\n")
238 func (n *ninjaWriter) Default(pkgNames map[*packageContext]string, targets ...ninjaString) error {
239 n.justDidBlankLine = false
245 ninjaWriter: n,
259 func (n *ninjaWriter) Subninja(file string) error {
260 n.justDidBlankLine = false
261 return n.writeStatement("subninja", file)
264 func (n *ninjaWriter) BlankLine() (err error) {
266 if !n.justDidBlankLine {
267 n.justDidBlankLine = true
268 _, err = n.writer.WriteString("\n")
273 func (n *ninjaWriter) writeStatement(directive, name string) error {
274 _, err := n.writer.WriteString(directive + " ")
278 _, err = n.writer.WriteString(name)
282 _, err = n.writer.WriteString("\n")
320 func (n *ninjaWriterWithWrap) WriteString(s string) (written int, noError error) {
325 if n.err != nil {
330 if !n.space {
333 n.lineLen += len(s)
334 _, n.err = n.writer.WriteString(s)
335 } else if n.lineLen+len(s)+spaceLen > n.maxLineLen {
339 _, n.err = n.writer.WriteString(" $\n")
340 if n.err != nil {
343 _, n.err = n.writer.WriteString(indentString[:indentWidth*2])
344 if n.err != nil {
347 n.lineLen = indentWidth*2 + n.pendingLen
349 n.pending = append(n.pending, s)
350 n.writePending()
352 n.space = false
356 n.pending = append(n.pending, s)
357 n.pendingLen += len(s)
358 n.lineLen += len(s)
365 func (n *ninjaWriterWithWrap) Space() {
366 if n.err != nil {
369 if n.space {
372 _, n.err = n.writer.WriteString(" ")
373 n.lineLen++
374 n.writePending()
376 n.space = true
380 func (n *ninjaWriterWithWrap) writePending() {
381 if n.err != nil {
384 for _, pending := range n.pending {
385 _, n.err = n.writer.WriteString(pending)
386 if n.err != nil {
392 n.pending = n.pending[:0]
393 n.pendingLen = 0
397 func (n *ninjaWriterWithWrap) WriteStringWithSpace(s string) {
398 n.Space()
399 _, _ = n.WriteString(s)
404 func (n *ninjaWriterWithWrap) Flush() error {
405 if n.space {
406 _, n.err = n.writer.WriteString(" ")
408 n.writePending()
409 if n.err != nil {
410 return n.err
412 _, err := n.writer.WriteString("\n")