26 Jan 2021 07:56:30 UTC
- Distribution: Language-FormulaEngine
- Module version: 0.06
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (138 / 1 / 0)
- KwaliteeBus factor: 1
- 80.84% Coverage
- License: perl_5
- Activity24 month
- Download (39.73KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- EXPORTED FUNCTIONS
- COPYRIGHT AND LICENSE
Language::FormulaEngine::Parser::ContextUtil - utility methods for parsers
my ($line, $col)= calc_text_coordinates( $buffer, $pos ); my ($line, $col)= calc_text_coordinates( $buffer, $pos, $buffer_line, $buffer_col );
Returns the 0-based line number and character number of an offset within a buffer. The line/column of the start of the buffer can be given as additional arguments.
my $message= format_context_string( $buffer, $token_start, $token_limit, $buffer_line, $buffer_col ); # "'blah blah' on line 15, char 12"
Returns a single-string view of where the token occurs in the buffer. This is useful for single-line "die" messages.
my $tty_text= format_context_multiline( $buffer, $token_start, $token_limit, \%args ); # "blah blah blah token blah blah\n" # ." ^^^^^\n" # ." (line 15, char 16)\n";
More advanced view of the input string, printed on three lines with the second marking the token within its context and third listing the line/column. This is only useful with a fixed-width font in a multi-line context.
This method also supports various options for formatting.
Michael Conrad <firstname.lastname@example.org>
This software is copyright (c) 2021 by Michael Conrad, IntelliTree Solutions llc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Language::FormulaEngine, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Language::FormulaEngine
For more information on module installation, please visit the detailed CPAN module installation guide.