summaryrefslogtreecommitdiff
path: root/src/dged/lang.h
blob: 51d9ac38dacfa2c1e6359f3f09442384fe79ad72 (plain)
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
#ifndef _LANG_H
#define _LANG_H

#include <stdbool.h>
#include <stdint.h>

/**
 * Settings for a programming language.
 */
struct language {
  /** Language id */
  const char *id;

  /** Descriptive name of the programming language */
  const char *name;

  /** Tab width for indentation */
  uint32_t tab_width;

  /** Path to the language server */
  const char *lang_srv;
};

/**
 * Initialize languages.
 *
 * @param[in] register_default Set to true to register some well known
 * languages.
 */
void languages_init(bool register_default);

/**
 * Get a language config by file name.
 *
 * @param[in] filename File name.
 * @returns A language config instance or the default language if not found.
 */
struct language lang_from_filename(const char *filename);

/**
 * Get a language config by id. The language id is a short (all-lowercase)
 * string identifying the language.
 *
 * @param[in] id The language id.
 * @returns A language config instance or the default language if not found.
 */
struct language lang_from_id(const char *id);

#endif