• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

/usr/lib/swipl/library/prolog_source.pl
All Application Manual Name SummaryHelp

  • swipl
    • library
      • error.pl
      • debug.pl
      • apply.pl
      • lists.pl
      • broadcast.pl
      • shlib.pl
      • option.pl
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl
      • settings.pl
      • arithmetic.pl
      • main.pl
      • readutil.pl
      • operators.pl -- Manage operators
      • pairs.pl
      • prolog_source.pl -- Examine Prolog source-files
        • quasi_quotation_syntax/2
        • xref_open_source/2
        • xref_close_source/2
        • prolog_read_source_term/4
        • requires_library/2
        • load_quasi_quotation_syntax/2
        • read_source_term_at_location/3
        • prolog_file_directives/3
        • prolog_open_source/2
        • prolog_close_source/1
        • prolog_canonical_source/2
        • file_name_on_path/2
        • file_alias_path/2
        • path_segments_atom/2
        • directory_source_files/3
        • valid_term_position/2
      • quasi_quotations.pl -- Define Quasi Quotation syntax
      • url.pl
      • www_browser.pl -- Open a URL in the users browser
      • prolog_colour.pl -- Prolog syntax colouring support.
      • record.pl -- Access compound arguments by name
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • occurs.pl
      • ordsets.pl
      • assoc.pl -- Binary associations
      • ugraphs.pl
      • solution_sequences.pl
      • atom.pl
      • prolog_pack.pl -- A package manager for Prolog
      • git.pl -- Run GIT commands
      • ctypes.pl
      • utf8.pl
      • base64.pl
      • persistency.pl
      • pure_input.pl
      • nb_set.pl -- Non-backtrackable sets
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • csv.pl
      • iostream.pl -- Utilities to deal with streams
      • dialect.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl
      • prolog_code.pl -- Utilities for reasoning about code
      • dif.pl -- The dif/2 constraint
      • thread.pl -- High level thread primitives
      • predicate_options.pl
      • rbtrees.pl
      • nb_rbtrees.pl -- Non-backtrackable operations on red black trees
      • sandbox.pl
      • prolog_format.pl
      • random.pl
      • pprint.pl
      • modules.pl
      • lazy_lists.pl
      • edinburgh.pl
      • prolog_clause.pl
      • prolog_breakpoints.pl
      • dicts.pl
      • prolog_config.pl
      • shell.pl
      • backcomp.pl
      • charsio.pl -- I/O on Lists of Character Codes
      • base32.pl
      • heaps.pl -- heaps/priority queues
      • prolog_debug.pl
      • date.pl -- Process dates and times
      • threadutil.pl -- Interactive thread utilities
      • terms.pl
      • edit.pl
      • make.pl -- Reload modified source files
      • wfs.pl -- Well Founded Semantics interface
      • check.pl
      • codesio.pl -- I/O on Lists of Character Codes
      • statistics.pl
      • coinduction.pl -- Co-Logic Programming
      • files.pl
      • strings.pl
      • tableutil.pl -- Table inspection and statistics utilities
      • increval.pl
      • tables.pl
      • hashtable.pl
      • help.pl
      • prolog_trace.pl -- Print access to predicates
      • prolog_jiti.pl
      • intercept.pl
      • listing.pl
      • macros.pl
      • optparse.pl
      • prolog_coverage.pl
      • sort.pl
      • prolog_stack.pl
      • prolog_codewalk.pl
      • prolog_profile.pl
      • quintus.pl
      • qsave.pl
      • zip.pl
      • prolog_autoload.pl -- Autoload all dependencies
      • ansi_term.pl -- Print decorated text to ANSI consoles
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • varnumbers.pl -- Utilities for numbered terms
      • when.pl
      • system.pl
      • prolog_wrap.pl
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • exceptions.pl
      • tty.pl
      • oset.pl
      • portray_text.pl
      • writef.pl
      • streams.pl -- Manage Prolog streams
      • fastrw.pl
      • explain.pl
      • prolog_history.pl
 read_source_term_at_location(+Stream, -Term, +Options) is semidet
Try to read a Prolog term form an arbitrary location inside a file. Due to Prolog's dynamic syntax, e.g., due to operator declarations that may change anywhere inside the file, this is theoreticaly impossible. Therefore, this predicate is fundamentally heuristic and may fail. This predicate is used by e.g., clause_info/4 and by PceEmacs to colour the current clause.

This predicate has two ways to find the right syntax. If the file is loaded, it can be passed the module using the module option. This deals with module files that define the used operators globally for the file. Second, there is a hook alternate_syntax/4 that can be used to temporary redefine the syntax.

The options below are processed in addition to the options of read_term/3. Note that the line and offset options are mutually exclusive.

line(+Line)
If present, start reading at line Line.
offset(+Characters)
Use seek/4 to go to the indicated location. See seek/4 for limitations of seeking in text-files.
module(+Module)
Use syntax from the given module. Default is the current `source module'.
operators(+List)
List of additional operator declarations to enforce while reading the term.
error(-Error)
If no correct parse can be found, unify Error with a term Offset:Message that indicates the (character) location of the error and the related message. Adding this option makes read_source_term_at_location/3 deterministic (det).
See also
- Use read_source_term/4 to read a file from the start.
- alternate_syntax/4 for locally scoped operators.
ClioPatria (version V3.1.1-59-g7b9a7a3)