File: Lexing.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 (151 lines) | stat: -rwxr-xr-x 6,566 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//==========================================================================
// LexBuffers are for use with automatically generated lexical analyzers,
// in particular those produced by 'fslex'.
//
// (c) Microsoft Corporation 2005-2008.
//===========================================================================

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

open System.Collections.Generic

/// Position information stored for lexing tokens
//
// Note: this is an OCaml compat record type. 
#if INTERNALIZED_POWER_PACK
type internal Position = 
#else
type Position = 
#endif
    { /// The file name for the position
      pos_fname: string;
      /// The line number for the position
      pos_lnum: int;
#if INTERNALIZED_POWER_PACK
      /// The line number for the position in the original source file
      pos_orig_lnum : int;
#endif
      /// The absolute offset of the beginning of the line
      pos_bol: int;
      /// The absolute offset of the column for the position
      pos_cnum: int; }
     /// The file name associated with the input stream.
     member FileName : string
     /// The line number in the input stream, assuming fresh positions have been updated 
     /// using AsNewLinePos() and by modifying the EndPos property of the LexBuffer.
     member Line : int
#if INTERNALIZED_POWER_PACK
     /// The line number for the position in the input stream, assuming fresh positions have been updated 
     /// using AsNewLinePos()
     member OriginalLine : int
#endif
     [<System.ObsoleteAttribute("Use the AbsoluteOffset property instead")>]
     member Char : int
     /// The character number in the input stream
     member AbsoluteOffset : int
     /// Return absolute offset of the start of the line marked by the position
     member StartOfLineAbsoluteOffset : int
     /// Return the column number marked by the position, i.e. the difference between the AbsoluteOffset and the StartOfLineAbsoluteOffset
     member Column : int
     // Given a position just beyond the end of a line, return a position at the start of the next line
     member NextLine : Position     
     
     /// Given a position at the start of a token of length n, return a position just beyond the end of the token
     member EndOfToken: n:int -> Position
     /// Gives a position shifted by specified number of characters
     member ShiftColumnBy: by:int -> Position
     
     [<System.ObsoleteAttribute("Consider using the NextLine property instead")>]
     member AsNewLinePos : unit -> Position
     
     /// Get an arbitrary position, with the empty string as filename, and  
     static member Empty : Position

     /// Get a position corresponding to the first line (line number 1) in a given file
     static member FirstLine : filename:string -> Position
    
[<Sealed>]
#if INTERNALIZED_POWER_PACK
type internal LexBuffer<'char> =
#else
/// Input buffers consumed by lexers generated by <c>fslex.exe </c>
type LexBuffer<'char> =
#endif
    /// The start position for the lexeme
    member StartPos: Position with get,set
    /// The end position for the lexeme
    member EndPos: Position with get,set
    /// The matched string 
    member Lexeme: 'char array
    
    /// Fast helper to turn the matched characters into a string, avoiding an intermediate array
    static member LexemeString : LexBuffer<char> -> string
    
    /// The length of the matched string 
    member LexemeLength: int
    /// Fetch a particular character in the matched string 
    member LexemeChar: int -> 'char

    /// Dynamically typed, non-lexically scoped parameter table
    member BufferLocalStore : IDictionary<string,obj>
    
    /// True if the refill of the buffer ever failed , or if explicitly set to true.
    member IsPastEndOfStream: bool with get,set
    /// Remove all input, though don't discard the current lexeme 
    member DiscardInput: unit -> unit

    /// Create a lex buffer suitable for byte lexing that reads characters from the given array
    static member FromBytes: byte[] -> LexBuffer<byte>
    /// Create a lex buffer suitable for Unicode lexing that reads characters from the given array
    static member FromChars: char[] -> LexBuffer<char>
    /// Create a lex buffer suitable for Unicode lexing that reads characters from the given string
    static member FromString: string -> LexBuffer<char>
    /// Create a lex buffer that reads character or byte inputs by using the given function
    static member FromFunction: ('char[] * int * int -> int) -> LexBuffer<'char>
    /// Create a lex buffer that asynchronously reads character or byte inputs by using the given function
    static member FromAsyncFunction: ('char[] * int * int -> Async<int>) -> LexBuffer<'char>


    [<System.Obsolete("Use LexBuffer<char>.FromFunction instead")>]
    static member FromCharFunction: (char[] -> int -> int) -> LexBuffer<char>
    [<System.Obsolete("Use LexBuffer<byte>.FromFunction instead")>]
    static member FromByteFunction: (byte[] -> int -> int) -> LexBuffer<byte>

    /// Create a lex buffer suitable for use with a Unicode lexer that reads character inputs from the given text reader
    static member FromTextReader: System.IO.TextReader -> LexBuffer<char>
    /// Create a lex buffer suitable for use with ASCII byte lexing that reads byte inputs from the given binary reader
    static member FromBinaryReader: System.IO.BinaryReader -> LexBuffer<byte>


/// The type of tables for an ascii lexer generated by fslex. 
[<Sealed>]
#if INTERNALIZED_POWER_PACK
type internal AsciiTables =
#else
type AsciiTables =
#endif
    static member Create : uint16[] array * uint16[] -> AsciiTables
    /// Interpret tables for an ascii lexer generated by fslex. 
    member Interpret:  initialState:int * LexBuffer<byte>  -> int
    /// Interpret tables for an ascii lexer generated by fslex, processing input asynchronously
    member AsyncInterpret:  initialState:int * LexBuffer<byte> -> Async<int>


/// The type of tables for an unicode lexer generated by fslex. 
[<Sealed>]
#if INTERNALIZED_POWER_PACK
type internal UnicodeTables =
#else
type UnicodeTables =
#endif
    static member Create : uint16[] array * uint16[] -> UnicodeTables
    /// Interpret tables for a unicode lexer generated by fslex. 
    member Interpret:  initialState:int * LexBuffer<char> -> int

    /// Interpret tables for a unicode lexer generated by fslex, processing input asynchronously
    member AsyncInterpret:  initialState:int * LexBuffer<char> -> Async<int>