File: Parsing.fsi

package info (click to toggle)
fsharp 3.1.1.26%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 59,244 kB
  • ctags: 4,190
  • sloc: cs: 13,398; ml: 1,098; sh: 399; makefile: 293; xml: 82
file content (130 lines) | stat: -rwxr-xr-x 5,177 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//==========================================================================
// (c) Microsoft Corporation 2005-2009.
//=========================================================================

#if INTERNALIZED_POWER_PACK
namespace Internal.Utilities.Text.Parsing
open Internal.Utilities
open Internal.Utilities.Text.Lexing
#else
namespace Microsoft.FSharp.Text.Parsing
open Microsoft.FSharp.Text.Lexing
#endif

open System.Collections.Generic

#if INTERNALIZED_POWER_PACK
type internal IParseState = 
#else
/// The information accessible via the <c>parseState</c> value within parser actions.
type IParseState = 
#endif
    /// Get the start and end position for the terminal or non-terminal at a given index matched by the production
    abstract InputRange: index:int -> Position * Position
    /// Get the end position for the terminal or non-terminal at a given index matched by the production
    abstract InputEndPosition: int -> Position 
    /// Get the start position for the terminal or non-terminal at a given index matched by the production
    abstract InputStartPosition: int -> Position 
    /// Get the full range of positions matched by the production
    abstract ResultRange: Position * Position
    /// Get the value produced by the terminal or non-terminal at the given position
    abstract GetInput   : int -> obj 
    /// Get the store of local values associated with this parser
    // Dynamically typed, non-lexically scoped local store
    abstract ParserLocalStore : IDictionary<string,obj>
    /// Raise an error in this parse context
    abstract RaiseError<'b> : unit -> 'b 


[<Sealed>]
#if INTERNALIZED_POWER_PACK
type internal ParseErrorContext<'tok> =
#else
/// The context provided when a parse error occurs
type ParseErrorContext<'tok> =
#endif
      /// The stack of state indexes active at the parse error 
      member StateStack  : int list
      /// The state active at the parse error 
      member ParseState : IParseState
      /// The tokens that would cause a reduction at the parse error 
      member ReduceTokens: int list
      /// The stack of productions that would be reduced at the parse error 
      member ReducibleProductions : int list list
      /// The token that caused the parse error
      member CurrentToken : 'tok option
      /// The token that would cause a shift at the parse error
      member ShiftTokens : int list
      /// The message associated with the parse error
      member Message : string

/// Tables generated by fsyacc
#if INTERNALIZED_POWER_PACK
type internal Tables<'tok> = 
#else
/// The type of the tables contained in a file produced by the fsyacc.exe parser generator.
type Tables<'tok> = 
#endif
    { /// The reduction table
      reductions: (IParseState -> obj) array ;
      /// The token number indicating the end of input
      endOfInputTag: int;
      /// A function to compute the tag of a token
      tagOfToken: 'tok -> int;
      /// A function to compute the data carried by a token
      dataOfToken: 'tok -> obj; 
      /// The sparse action table elements
      actionTableElements: uint16[];
      /// The sparse action table row offsets
      actionTableRowOffsets: uint16[];
      /// The number of symbols for each reduction
      reductionSymbolCounts: uint16[];
      /// The immediate action table
      immediateActions: uint16[];      
      /// The sparse goto table
      gotos: uint16[];
      /// The sparse goto table row offsets
      sparseGotoTableRowOffsets: uint16[];
      /// The sparse table for the productions active for each state
      stateToProdIdxsTableElements: uint16[];  
      /// The sparse table offsets for the productions active for each state
      stateToProdIdxsTableRowOffsets: uint16[];  
      /// This table is logically part of the Goto table
      productionToNonTerminalTable: uint16[];
      /// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions
      parseError:  ParseErrorContext<'tok> -> unit;
      /// The total number of terminals 
      numTerminals: int;
      /// The tag of the error terminal
      tagOfErrorTerminal: int }

    /// Interpret the parser table taking input from the given lexer, using the given lex buffer, and the given start state.
    /// Returns an object indicating the final synthesized value for the parse.
    member Interpret :  lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj 

#if INTERNALIZED_POWER_PACK
exception internal Accept of obj
exception internal RecoverableParseError
#else
/// Indicates an accept action has occured
exception Accept of obj
/// Indicates a parse error has occured and parse recovery is in progress
exception RecoverableParseError
#endif

#if DEBUG
module internal Flags =
  val mutable debug : bool
#endif

#if INTERNALIZED_POWER_PACK
module internal ParseHelpers = 
#else
/// Helpers used by generated parsers.
module ParseHelpers = 
#endif
   /// The default implementation of the parse_error_rich function
   val parse_error_rich: (ParseErrorContext<'tok> -> unit) option
   /// The default implementation of the parse_error function
   val parse_error: string -> unit