1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
|
---|
6 | using OfficeOpenXml.FormulaParsing.ExpressionGraph;
|
---|
7 | using OfficeOpenXml.FormulaParsing.ExcelUtilities;
|
---|
8 | using OfficeOpenXml.FormulaParsing;
|
---|
9 | using OfficeOpenXml.FormulaParsing.Logging;
|
---|
10 |
|
---|
11 | namespace OfficeOpenXml.FormulaParsing
|
---|
12 | {
|
---|
13 | /// <summary>
|
---|
14 | /// Parsing context
|
---|
15 | /// </summary>
|
---|
16 | public class ParsingContext : IParsingLifetimeEventHandler
|
---|
17 | {
|
---|
18 | private ParsingContext() { }
|
---|
19 |
|
---|
20 | /// <summary>
|
---|
21 | /// The <see cref="FormulaParser"/> of the current context.
|
---|
22 | /// </summary>
|
---|
23 | public FormulaParser Parser { get; set; }
|
---|
24 |
|
---|
25 | /// <summary>
|
---|
26 | /// The <see cref="ExcelDataProvider"/> is an abstraction on top of
|
---|
27 | /// Excel, in this case EPPlus.
|
---|
28 | /// </summary>
|
---|
29 | public ExcelDataProvider ExcelDataProvider { get; set; }
|
---|
30 |
|
---|
31 | /// <summary>
|
---|
32 | /// Utility for handling addresses
|
---|
33 | /// </summary>
|
---|
34 | public RangeAddressFactory RangeAddressFactory { get; set; }
|
---|
35 |
|
---|
36 | /// <summary>
|
---|
37 | /// <see cref="INameValueProvider"/> of the current context
|
---|
38 | /// </summary>
|
---|
39 | public INameValueProvider NameValueProvider { get; set; }
|
---|
40 |
|
---|
41 | /// <summary>
|
---|
42 | /// Configuration
|
---|
43 | /// </summary>
|
---|
44 | public ParsingConfiguration Configuration { get; set; }
|
---|
45 |
|
---|
46 | /// <summary>
|
---|
47 | /// Scopes, a scope represents the parsing of a cell or a value.
|
---|
48 | /// </summary>
|
---|
49 | public ParsingScopes Scopes { get; private set; }
|
---|
50 |
|
---|
51 | /// <summary>
|
---|
52 | /// Returns true if a <see cref="IFormulaParserLogger"/> is attached to the parser.
|
---|
53 | /// </summary>
|
---|
54 | public bool Debug
|
---|
55 | {
|
---|
56 | get { return Configuration.Logger != null; }
|
---|
57 | }
|
---|
58 |
|
---|
59 | /// <summary>
|
---|
60 | /// Factory method.
|
---|
61 | /// </summary>
|
---|
62 | /// <returns></returns>
|
---|
63 | public static ParsingContext Create()
|
---|
64 | {
|
---|
65 | var context = new ParsingContext();
|
---|
66 | context.Configuration = ParsingConfiguration.Create();
|
---|
67 | context.Scopes = new ParsingScopes(context);
|
---|
68 | return context;
|
---|
69 | }
|
---|
70 |
|
---|
71 | void IParsingLifetimeEventHandler.ParsingCompleted()
|
---|
72 | {
|
---|
73 |
|
---|
74 | }
|
---|
75 | }
|
---|
76 | }
|
---|