-
-
26 Jan 2021 07:56:30 UTC
- Distribution: Language-FormulaEngine
- Module version: 0.06
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers (138 / 1 / 0)
- Kwalitee
Bus factor: 1- 80.84% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (39.73KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Language::FormulaEngine::Parser::ContextUtil - utility methods for parsers
VERSION
version 0.06
EXPORTED FUNCTIONS
calc_text_coordinates
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.
format_context_string
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.
format_context_multiline
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.
AUTHOR
Michael Conrad <mconrad@intellitree.com>
COPYRIGHT AND LICENSE
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.
cpanm Language::FormulaEngine
perl -MCPAN -e shell install Language::FormulaEngine
For more information on module installation, please visit the detailed CPAN module installation guide.