Top
Back: Printing of data
Forward: option(warn)
FastBack: Libraries
FastForward: Dynamic loading
Up: Debugging tools
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

3.9.6 libparse

libparse is a stand-alone program contained in the SINGULAR distribution (at the place where the SINGULAR executable program resides), which cannot be called inside SINGULAR. It is a debugging tool for libraries which performs exactly the same checks as the load command in SINGULAR, but generates more output during parsing. libparse is useful if an error occurs while loading the library, but the whole block around the line specified seems to be correct. In these situations the real error might have occured hundreds of lines earlier in the library.

Usage:
libparse [options] singular-library
Options:

-d Debuglevel
increases the amount of output during parsing, where Debuglevel is an integer between 0 and 4. Default is 0.
-s
turns on reporting about violations of unenforced syntax rules

The following syntax checks are performed in any case:

  • counting of pairs of brackets {,} , [,] and (,) (number of { has to match number of }, same for [,] and (,) ).
  • counting of " ( number of " must be even ).
  • general library syntax ( only LIB, static, proc (with parameters, help, body and example) and comments, i.e // and /* ... */, are allowed).
Its output lists all procedures that have been parsed successfully:

 
$ libparse sample.lib
Checking library 'sample.lib'
  Library         function      line,start-eod line,body-eob  line,example-eoe
Version:0.0.0;
g Sample               tab line    9,  149-165   13,  271-298   14,  300-402
l Sample      internal_tab line   24,  450-475   25,  476-496    0,    0-496

where the following abbreviations are used:

  • g: global procedure (default)
  • l: static procedure, i.e., local to the library.

each of the following is the position of the byte in the library.

  • start: begin of 'proc'
  • eod: end of parameters
  • body: start of procedurebody '{'
  • eob: end of procedurebody '}'
  • example: position of 'example'
  • eoe: end of example '}'

Hence in the above example, the first procedure of the library sample.lib is user-accessible and its name is tab. The procedure starts in line 9, at character 149. The head of the procedure ends at character 165, the body starts in line 13 at character 271 and ends at character 298. The example section extends from line 14 character 300 to character 402.

The following example shows the result of a missing close-bracket } in line 26 of the library sample.lib.

 
LIB "sample.lib";
==>    ? Library sample.lib: ERROR occurred: in line 26, 497.
==>    ? missing close bracket '}' at end of library in line 26.
==>    ? Cannot load library,... aborting.
==>    ? error occurred in STDIN line 1: `LIB "sample.lib";`


Top Back: Printing of data Forward: option(warn) FastBack: Libraries FastForward: Dynamic loading Up: Debugging tools Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4-0-3, 2016, generated by texi2html.