ancpp/lib.rs
1// Copyright (c) 2026 Hemashushu <hippospark@gmail.com>, All rights reserved.
2//
3// This Source Code Form is subject to the terms of
4// the Mozilla Public License version 2.0 and additional exceptions.
5// For more details, see the LICENSE, LICENSE.additional, and CONTRIBUTING files.
6
7mod char_with_position;
8mod expression;
9mod initializer;
10mod lexer;
11mod location;
12mod parser;
13mod peekable_iter;
14mod position;
15mod processor;
16mod range;
17
18pub mod ast;
19pub mod ast_printer;
20pub mod context;
21pub mod error;
22pub mod error_printer;
23pub mod memory_file_provider;
24pub mod native_file_provider;
25pub mod token;
26
27pub use processor::process_source_file;
28
29// ANCPP reserves file number 0 for predefined macros.
30pub const FILE_NUMBER_PREDEFINED: usize = 0;
31
32// ANCPP automatically assigns file numbers to **header files**, starting from 1
33// (file number 0 is reserved for predefined macros).
34//
35// However, the number of **source files** are specified manually using
36// the `source_file_number` parameter of function `process_source_file`.
37//
38// To avoid conflicts with header files, this file number should be greater than
39// or equal to `FILE_NUMBER_SOURCE_FILE_BEGIN`, which is defined as 65536.
40pub const FILE_NUMBER_SOURCE_FILE_BEGIN: usize = 2_usize.pow(16);