v0.2.1 c0399be

gscanner.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11)
12
13// Specifies the type of the message handler function.
14type ScannerMsgFunc func(*Scanner, string, bool)
15
16// `GScanner` provides a general-purpose lexical scanner.
17//
18// You should set @input_name after creating the scanner, since
19// it is used by the default message handler when displaying
20// warnings and errors. If you are scanning a file, the filename
21// would be a good choice.
22//
23// The @user_data and @max_parse_errors fields are not used.
24// If you need to associate extra data with the scanner you
25// can place them here.
26//
27// If you want to use your own message handler you can set the
28// @msg_handler field. The type of the message handler function
29// is declared by #GScannerMsgFunc.
30type Scanner struct {
31	_ structs.HostLayout
32
33	UserData uintptr
34
35	MaxParseErrors uint
36
37	ParseErrors uint
38
39	InputName uintptr
40
41	Qdata *Data
42
43	Config *ScannerConfig
44
45	Token TokenType
46
47	Value TokenValue
48
49	Line uint
50
51	Position uint
52
53	NextToken TokenType
54
55	NextValue TokenValue
56
57	NextLine uint
58
59	NextPosition uint
60
61	SymbolTable *HashTable
62
63	InputFd int32
64
65	Text uintptr
66
67	TextEnd uintptr
68
69	Buffer uintptr
70
71	ScopeId uint
72
73	MsgHandler ScannerMsgFunc
74}
75
76func (x *Scanner) GoPointer() uintptr {
77	return uintptr(unsafe.Pointer(x))
78}
79
80var xScannerCurLine func(uintptr) uint
81
82// Returns the current line in the input stream (counting
83// from 1). This is the line of the last token parsed via
84// g_scanner_get_next_token().
85func (x *Scanner) CurLine() uint {
86
87	cret := xScannerCurLine(x.GoPointer())
88	return cret
89}
90
91var xScannerCurPosition func(uintptr) uint
92
93// Returns the current position in the current line (counting
94// from 0). This is the position of the last token parsed via
95// g_scanner_get_next_token().
96func (x *Scanner) CurPosition() uint {
97
98	cret := xScannerCurPosition(x.GoPointer())
99	return cret
100}
101
102var xScannerCurToken func(uintptr) TokenType
103
104// Gets the current token type. This is simply the @token
105// field in the #GScanner structure.
106func (x *Scanner) CurToken() TokenType {
107
108	cret := xScannerCurToken(x.GoPointer())
109	return cret
110}
111
112var xScannerCurValue func(uintptr) TokenValue
113
114// Gets the current token value. This is simply the @value
115// field in the #GScanner structure.
116func (x *Scanner) CurValue() TokenValue {
117
118	cret := xScannerCurValue(x.GoPointer())
119	return cret
120}
121
122var xScannerDestroy func(uintptr)
123
124// Frees all memory used by the #GScanner.
125func (x *Scanner) Destroy() {
126
127	xScannerDestroy(x.GoPointer())
128
129}
130
131var xScannerEof func(uintptr) bool
132
133// Returns %TRUE if the scanner has reached the end of
134// the file or text buffer.
135func (x *Scanner) Eof() bool {
136
137	cret := xScannerEof(x.GoPointer())
138	return cret
139}
140
141var xScannerError func(uintptr, string, ...interface{})
142
143// Outputs an error message, via the #GScanner message handler.
144func (x *Scanner) Error(FormatVar string, varArgs ...interface{}) {
145
146	xScannerError(x.GoPointer(), FormatVar, varArgs...)
147
148}
149
150var xScannerGetNextToken func(uintptr) TokenType
151
152// Parses the next token just like g_scanner_peek_next_token()
153// and also removes it from the input stream. The token data is
154// placed in the @token, @value, @line, and @position fields of
155// the #GScanner structure.
156func (x *Scanner) GetNextToken() TokenType {
157
158	cret := xScannerGetNextToken(x.GoPointer())
159	return cret
160}
161
162var xScannerInputFile func(uintptr, int)
163
164// Prepares to scan a file.
165func (x *Scanner) InputFile(InputFdVar int) {
166
167	xScannerInputFile(x.GoPointer(), InputFdVar)
168
169}
170
171var xScannerInputText func(uintptr, string, uint)
172
173// Prepares to scan a text buffer.
174func (x *Scanner) InputText(TextVar string, TextLenVar uint) {
175
176	xScannerInputText(x.GoPointer(), TextVar, TextLenVar)
177
178}
179
180var xScannerLookupSymbol func(uintptr, string) uintptr
181
182// Looks up a symbol in the current scope and return its value.
183// If the symbol is not bound in the current scope, %NULL is
184// returned.
185func (x *Scanner) LookupSymbol(SymbolVar string) uintptr {
186
187	cret := xScannerLookupSymbol(x.GoPointer(), SymbolVar)
188	return cret
189}
190
191var xScannerPeekNextToken func(uintptr) TokenType
192
193// Parses the next token, without removing it from the input stream.
194// The token data is placed in the @next_token, @next_value, @next_line,
195// and @next_position fields of the #GScanner structure.
196//
197// Note that, while the token is not removed from the input stream
198// (i.e. the next call to g_scanner_get_next_token() will return the
199// same token), it will not be reevaluated. This can lead to surprising
200// results when changing scope or the scanner configuration after peeking
201// the next token. Getting the next token after switching the scope or
202// configuration will return whatever was peeked before, regardless of
203// any symbols that may have been added or removed in the new scope.
204func (x *Scanner) PeekNextToken() TokenType {
205
206	cret := xScannerPeekNextToken(x.GoPointer())
207	return cret
208}
209
210var xScannerScopeAddSymbol func(uintptr, uint, string, uintptr)
211
212// Adds a symbol to the given scope.
213func (x *Scanner) ScopeAddSymbol(ScopeIdVar uint, SymbolVar string, ValueVar uintptr) {
214
215	xScannerScopeAddSymbol(x.GoPointer(), ScopeIdVar, SymbolVar, ValueVar)
216
217}
218
219var xScannerScopeForeachSymbol func(uintptr, uint, uintptr, uintptr)
220
221// Calls the given function for each of the symbol/value pairs
222// in the given scope of the #GScanner. The function is passed
223// the symbol and value of each pair, and the given @user_data
224// parameter.
225func (x *Scanner) ScopeForeachSymbol(ScopeIdVar uint, FuncVar *HFunc, UserDataVar uintptr) {
226
227	var FuncVarRef uintptr
228	if FuncVar != nil {
229		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
230		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
231			FuncVarRef = cbRefPtr
232		} else {
233			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
234				cbFn := *FuncVar
235				cbFn(arg0, arg1, arg2)
236			}
237			FuncVarRef = purego.NewCallback(fcb)
238			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
239		}
240	}
241
242	xScannerScopeForeachSymbol(x.GoPointer(), ScopeIdVar, FuncVarRef, UserDataVar)
243
244}
245
246var xScannerScopeLookupSymbol func(uintptr, uint, string) uintptr
247
248// Looks up a symbol in a scope and return its value. If the
249// symbol is not bound in the scope, %NULL is returned.
250func (x *Scanner) ScopeLookupSymbol(ScopeIdVar uint, SymbolVar string) uintptr {
251
252	cret := xScannerScopeLookupSymbol(x.GoPointer(), ScopeIdVar, SymbolVar)
253	return cret
254}
255
256var xScannerScopeRemoveSymbol func(uintptr, uint, string)
257
258// Removes a symbol from a scope.
259func (x *Scanner) ScopeRemoveSymbol(ScopeIdVar uint, SymbolVar string) {
260
261	xScannerScopeRemoveSymbol(x.GoPointer(), ScopeIdVar, SymbolVar)
262
263}
264
265var xScannerSetScope func(uintptr, uint) uint
266
267// Sets the current scope.
268func (x *Scanner) SetScope(ScopeIdVar uint) uint {
269
270	cret := xScannerSetScope(x.GoPointer(), ScopeIdVar)
271	return cret
272}
273
274var xScannerSyncFileOffset func(uintptr)
275
276// Rewinds the filedescriptor to the current buffer position
277// and blows the file read ahead buffer. This is useful for
278// third party uses of the scanners filedescriptor, which hooks
279// onto the current scanning position.
280func (x *Scanner) SyncFileOffset() {
281
282	xScannerSyncFileOffset(x.GoPointer())
283
284}
285
286var xScannerUnexpToken func(uintptr, TokenType, string, string, string, string, int)
287
288// Outputs a message through the scanner's msg_handler,
289// resulting from an unexpected token in the input stream.
290// Note that you should not call g_scanner_peek_next_token()
291// followed by g_scanner_unexp_token() without an intermediate
292// call to g_scanner_get_next_token(), as g_scanner_unexp_token()
293// evaluates the scanner's current token (not the peeked token)
294// to construct part of the message.
295func (x *Scanner) UnexpToken(ExpectedTokenVar TokenType, IdentifierSpecVar string, SymbolSpecVar string, SymbolNameVar string, MessageVar string, IsErrorVar int) {
296
297	xScannerUnexpToken(x.GoPointer(), ExpectedTokenVar, IdentifierSpecVar, SymbolSpecVar, SymbolNameVar, MessageVar, IsErrorVar)
298
299}
300
301var xScannerWarn func(uintptr, string, ...interface{})
302
303// Outputs a warning message, via the #GScanner message handler.
304func (x *Scanner) Warn(FormatVar string, varArgs ...interface{}) {
305
306	xScannerWarn(x.GoPointer(), FormatVar, varArgs...)
307
308}
309
310// Specifies the #GScanner parser configuration. Most settings can
311// be changed during the parsing phase and will affect the lexical
312// parsing of the next unpeeked token.
313type ScannerConfig struct {
314	_ structs.HostLayout
315
316	CsetSkipCharacters uintptr
317
318	CsetIdentifierFirst uintptr
319
320	CsetIdentifierNth uintptr
321
322	CpairCommentSingle uintptr
323
324	CaseSensitive uint
325
326	SkipCommentMulti uint
327
328	SkipCommentSingle uint
329
330	ScanCommentMulti uint
331
332	ScanIdentifier uint
333
334	ScanIdentifier1char uint
335
336	ScanIdentifierNULL uint
337
338	ScanSymbols uint
339
340	ScanBinary uint
341
342	ScanOctal uint
343
344	ScanFloat uint
345
346	ScanHex uint
347
348	ScanHexDollar uint
349
350	ScanStringSq uint
351
352	ScanStringDq uint
353
354	Numbers2Int uint
355
356	Int2Float uint
357
358	Identifier2String uint
359
360	Char2Token uint
361
362	Symbol2Token uint
363
364	Scope0Fallback uint
365
366	StoreInt64 uint
367
368	PaddingDummy uint
369}
370
371func (x *ScannerConfig) GoPointer() uintptr {
372	return uintptr(unsafe.Pointer(x))
373}
374
375// A union holding the value of the token.
376type TokenValue = uintptr
377
378const (
379	// The set of uppercase ASCII alphabet characters.
380	// Used for specifying valid identifier characters
381	// in #GScannerConfig.
382	CSET_A_2_Z string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
383	// The set of ASCII digits.
384	// Used for specifying valid identifier characters
385	// in #GScannerConfig.
386	CSET_DIGITS string = "0123456789"
387	// The set of lowercase ASCII alphabet characters.
388	// Used for specifying valid identifier characters
389	// in #GScannerConfig.
390	CSET_a_2_z string = "abcdefghijklmnopqrstuvwxyz"
391)
392
393// The possible errors, used in the @v_error field
394// of #GTokenValue, when the token is a %G_TOKEN_ERROR.
395type ErrorType int
396
397const (
398
399	// unknown error
400	GErrUnknownValue ErrorType = 0
401	// unexpected end of file
402	GErrUnexpEofValue ErrorType = 1
403	// unterminated string constant
404	GErrUnexpEofInStringValue ErrorType = 2
405	// unterminated comment
406	GErrUnexpEofInCommentValue ErrorType = 3
407	// non-digit character in a number
408	GErrNonDigitInConstValue ErrorType = 4
409	// digit beyond radix in a number
410	GErrDigitRadixValue ErrorType = 5
411	// non-decimal floating point number
412	GErrFloatRadixValue ErrorType = 6
413	// malformed floating point number
414	GErrFloatMalformedValue ErrorType = 7
415)
416
417// The possible types of token returned from each
418// g_scanner_get_next_token() call.
419type TokenType int
420
421const (
422
423	// the end of the file
424	GTokenEofValue TokenType = 0
425	// a '(' character
426	GTokenLeftParenValue TokenType = 40
427	// a ')' character
428	GTokenRightParenValue TokenType = 41
429	// a '{' character
430	GTokenLeftCurlyValue TokenType = 123
431	// a '}' character
432	GTokenRightCurlyValue TokenType = 125
433	// a '[' character
434	GTokenLeftBraceValue TokenType = 91
435	// a ']' character
436	GTokenRightBraceValue TokenType = 93
437	// a '=' character
438	GTokenEqualSignValue TokenType = 61
439	// a ',' character
440	GTokenCommaValue TokenType = 44
441	// not a token
442	GTokenNoneValue TokenType = 256
443	// an error occurred
444	GTokenErrorValue TokenType = 257
445	// a character
446	GTokenCharValue TokenType = 258
447	// a binary integer
448	GTokenBinaryValue TokenType = 259
449	// an octal integer
450	GTokenOctalValue TokenType = 260
451	// an integer
452	GTokenIntValue TokenType = 261
453	// a hex integer
454	GTokenHexValue TokenType = 262
455	// a floating point number
456	GTokenFloatValue TokenType = 263
457	// a string
458	GTokenStringValue TokenType = 264
459	// a symbol
460	GTokenSymbolValue TokenType = 265
461	// an identifier
462	GTokenIdentifierValue TokenType = 266
463	// a null identifier
464	GTokenIdentifierNullValue TokenType = 267
465	// one line comment
466	GTokenCommentSingleValue TokenType = 268
467	// multi line comment
468	GTokenCommentMultiValue TokenType = 269
469)
470
471func init() {
472	core.SetPackageName("GLIB", "glib-2.0")
473	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
474	var libs []uintptr
475	for _, libPath := range core.GetPaths("GLIB") {
476		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
477		if err != nil {
478			panic(err)
479		}
480		libs = append(libs, lib)
481	}
482
483	core.PuregoSafeRegister(&xScannerCurLine, libs, "g_scanner_cur_line")
484	core.PuregoSafeRegister(&xScannerCurPosition, libs, "g_scanner_cur_position")
485	core.PuregoSafeRegister(&xScannerCurToken, libs, "g_scanner_cur_token")
486	core.PuregoSafeRegister(&xScannerCurValue, libs, "g_scanner_cur_value")
487	core.PuregoSafeRegister(&xScannerDestroy, libs, "g_scanner_destroy")
488	core.PuregoSafeRegister(&xScannerEof, libs, "g_scanner_eof")
489	core.PuregoSafeRegister(&xScannerError, libs, "g_scanner_error")
490	core.PuregoSafeRegister(&xScannerGetNextToken, libs, "g_scanner_get_next_token")
491	core.PuregoSafeRegister(&xScannerInputFile, libs, "g_scanner_input_file")
492	core.PuregoSafeRegister(&xScannerInputText, libs, "g_scanner_input_text")
493	core.PuregoSafeRegister(&xScannerLookupSymbol, libs, "g_scanner_lookup_symbol")
494	core.PuregoSafeRegister(&xScannerPeekNextToken, libs, "g_scanner_peek_next_token")
495	core.PuregoSafeRegister(&xScannerScopeAddSymbol, libs, "g_scanner_scope_add_symbol")
496	core.PuregoSafeRegister(&xScannerScopeForeachSymbol, libs, "g_scanner_scope_foreach_symbol")
497	core.PuregoSafeRegister(&xScannerScopeLookupSymbol, libs, "g_scanner_scope_lookup_symbol")
498	core.PuregoSafeRegister(&xScannerScopeRemoveSymbol, libs, "g_scanner_scope_remove_symbol")
499	core.PuregoSafeRegister(&xScannerSetScope, libs, "g_scanner_set_scope")
500	core.PuregoSafeRegister(&xScannerSyncFileOffset, libs, "g_scanner_sync_file_offset")
501	core.PuregoSafeRegister(&xScannerUnexpToken, libs, "g_scanner_unexp_token")
502	core.PuregoSafeRegister(&xScannerWarn, libs, "g_scanner_warn")
503
504}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close