Print debugging statement: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added highlighting.)
Line 351: Line 351:
[DEBUG][PrintDebugStatement.java PrintDebugStatement.blah#26] Made It!
[DEBUG][PrintDebugStatement.java PrintDebugStatement.blah#26] Made It!
[DEBUG][PrintDebugStatement.java PrintDebugStatement.lambda$main$0#33] oops</pre>
[DEBUG][PrintDebugStatement.java PrintDebugStatement.lambda$main$0#33] oops</pre>

=={{header|Julia}}==
{{works with|jq}}
'''The Go implementation supports debug and input_filename'''

Both the C and the Go-based implementations of jq support the `debug` and `input_filename` filters. The C implementation has additional debugging support as described below.

'''debug'''

The '''debug''' built-in is a 0-arity filter which behaves somewhat like `tee /dev/stderr` in *ix -- that is, it prints its input as a message to '''stderr''' and also passes it along to the next filter, as illustrated by this transcript:
<lang sh>
jq -n '"abc" | debug | length'
["DEBUG:","abc"]
3
</lang>

'''$__loc__'''

The C implementation of jq provides the variable '''$__loc__''' for accessing the file and line number in the source code where it is located, though currently $__loc__.file only provides informative information when it is called from within a module file.

'''input_filename'''

In both the C and Go implementations, this holds the file name of the file from which data is currently being read.

'''input_line_number'''

Currently, this companion to '''input_filename''' is only supported by the C implementation of jq.


=={{header|Julia}}==
=={{header|Julia}}==