From bbde38f6567f7d4fceaf99ae4b74bcc7e23e528c Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Sun, 5 Jan 2020 10:40:44 +0000 Subject: [PATCH] move tokenizers to their own project since both pdfs and Adobe Type1 fonts use postscript type objects, tokenization is needed by the main project and the fonts project --- .../OctalHelpers.cs | 18 ++++++-- ...yToad.PdfPig.DocumentLayoutAnalysis.csproj | 2 + .../Type1}/Type1ArrayTokenizer.cs | 8 +++- .../Type1}/Type1NameTokenizer.cs | 9 ++-- .../UglyToad.PdfPig.Fonts.csproj | 1 + .../UglyToad.PdfPig.Tests.csproj | 1 + .../Util/OctalHelpersTests.cs | 2 +- .../ArrayTokenizer.cs | 0 .../AssemblyInfo.cs | 3 ++ .../CommentTokenizer.cs | 1 - .../DictionaryTokenizer.cs | 4 -- .../EndOfLineTokenizer.cs | 7 ++- .../HexTokenizer.cs | 1 - .../ITokenizer.cs | 24 ++++++++++ .../NameTokenizer.cs | 1 - .../NumericTokenizer.cs | 0 .../PlainTokenizer.cs | 1 - .../Scanner/CoreTokenScanner.cs | 44 ++++++++++++------- .../Scanner/ISeekableTokenScanner.cs | 29 ++++++++++++ .../Scanner/ITokenScanner.cs | 26 +++++++++++ .../Scanner/ScannerScope.cs | 21 +++++++++ .../StringTokenizer.cs | 2 - .../UglyToad.PdfPig.Tokenization.csproj | 23 ++++++++++ src/UglyToad.PdfPig.sln | 6 +++ .../PdfFonts/Encodings/MacExpertEncoding.cs | 2 +- .../PdfFonts/Encodings/MacOsRomanEncoding.cs | 2 +- .../PdfFonts/Encodings/MacRomanEncoding.cs | 2 +- .../PdfFonts/Encodings/StandardEncoding.cs | 2 +- .../PdfFonts/Encodings/WinAnsiEncoding.cs | 2 +- .../PdfFonts/Type1/Parser/Type1FontParser.cs | 1 + .../Tokenization/ITokenizer.cs | 12 ----- .../Tokenization/Scanner/ITokenScanner.cs | 24 ---------- .../Tokenization/Scanner/ScannerScope.cs | 9 ---- src/UglyToad.PdfPig/UglyToad.PdfPig.csproj | 1 + 34 files changed, 205 insertions(+), 86 deletions(-) rename src/{UglyToad.PdfPig/Util => UglyToad.PdfPig.Core}/OctalHelpers.cs (81%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Fonts/Type1}/Type1ArrayTokenizer.cs (91%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Fonts/Type1}/Type1NameTokenizer.cs (84%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/ArrayTokenizer.cs (100%) create mode 100644 src/UglyToad.PdfPig.Tokenization/AssemblyInfo.cs rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/CommentTokenizer.cs (96%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/DictionaryTokenizer.cs (96%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/EndOfLineTokenizer.cs (71%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/HexTokenizer.cs (98%) create mode 100644 src/UglyToad.PdfPig.Tokenization/ITokenizer.cs rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/NameTokenizer.cs (99%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/NumericTokenizer.cs (100%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/PlainTokenizer.cs (98%) rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/Scanner/CoreTokenScanner.cs (92%) create mode 100644 src/UglyToad.PdfPig.Tokenization/Scanner/ISeekableTokenScanner.cs create mode 100644 src/UglyToad.PdfPig.Tokenization/Scanner/ITokenScanner.cs create mode 100644 src/UglyToad.PdfPig.Tokenization/Scanner/ScannerScope.cs rename src/{UglyToad.PdfPig/Tokenization => UglyToad.PdfPig.Tokenization}/StringTokenizer.cs (99%) create mode 100644 src/UglyToad.PdfPig.Tokenization/UglyToad.PdfPig.Tokenization.csproj delete mode 100644 src/UglyToad.PdfPig/Tokenization/ITokenizer.cs delete mode 100644 src/UglyToad.PdfPig/Tokenization/Scanner/ITokenScanner.cs delete mode 100644 src/UglyToad.PdfPig/Tokenization/Scanner/ScannerScope.cs diff --git a/src/UglyToad.PdfPig/Util/OctalHelpers.cs b/src/UglyToad.PdfPig.Core/OctalHelpers.cs similarity index 81% rename from src/UglyToad.PdfPig/Util/OctalHelpers.cs rename to src/UglyToad.PdfPig.Core/OctalHelpers.cs index 5d8defc4..5577537e 100644 --- a/src/UglyToad.PdfPig/Util/OctalHelpers.cs +++ b/src/UglyToad.PdfPig.Core/OctalHelpers.cs @@ -1,9 +1,15 @@ -namespace UglyToad.PdfPig.Util +namespace UglyToad.PdfPig.Core { using System; - internal static class OctalHelpers + /// + /// Interprets numbers in octal format. + /// + public static class OctalHelpers { + /// + /// Read a short. + /// public static short CharacterToShort(this char c) { switch (c) @@ -33,10 +39,11 @@ } } + /// + /// Read an integer from octal digits. + /// public static int FromOctalDigits(short[] octal) { - - int sum = 0; for (int i = octal.Length - 1; i >= 0; i--) { @@ -47,6 +54,9 @@ return sum; } + /// + /// Interpret an int as octal. + /// public static int FromOctalInt(int input) { var str = input.ToString(); diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/UglyToad.PdfPig.DocumentLayoutAnalysis.csproj b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/UglyToad.PdfPig.DocumentLayoutAnalysis.csproj index 6aa0c4c3..f5951e85 100644 --- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/UglyToad.PdfPig.DocumentLayoutAnalysis.csproj +++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/UglyToad.PdfPig.DocumentLayoutAnalysis.csproj @@ -18,6 +18,8 @@ + + \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/Type1ArrayTokenizer.cs b/src/UglyToad.PdfPig.Fonts/Type1/Type1ArrayTokenizer.cs similarity index 91% rename from src/UglyToad.PdfPig/Tokenization/Type1ArrayTokenizer.cs rename to src/UglyToad.PdfPig.Fonts/Type1/Type1ArrayTokenizer.cs index 1b27701b..a8c69a6c 100644 --- a/src/UglyToad.PdfPig/Tokenization/Type1ArrayTokenizer.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/Type1ArrayTokenizer.cs @@ -1,4 +1,4 @@ -namespace UglyToad.PdfPig.Tokenization +namespace UglyToad.PdfPig.Fonts.Type1 { using System; using System.Collections.Generic; @@ -6,11 +6,15 @@ using System.Text; using Core; using Tokens; + using Tokenization; - internal class Type1ArrayTokenizer : ITokenizer + /// + public class Type1ArrayTokenizer : ITokenizer { + /// public bool ReadsNextByte { get; } = false; + /// public bool TryTokenize(byte currentByte, IInputBytes inputBytes, out IToken token) { token = null; diff --git a/src/UglyToad.PdfPig/Tokenization/Type1NameTokenizer.cs b/src/UglyToad.PdfPig.Fonts/Type1/Type1NameTokenizer.cs similarity index 84% rename from src/UglyToad.PdfPig/Tokenization/Type1NameTokenizer.cs rename to src/UglyToad.PdfPig.Fonts/Type1/Type1NameTokenizer.cs index 09fd9577..d00dd1df 100644 --- a/src/UglyToad.PdfPig/Tokenization/Type1NameTokenizer.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/Type1NameTokenizer.cs @@ -1,14 +1,17 @@ -namespace UglyToad.PdfPig.Tokenization +namespace UglyToad.PdfPig.Fonts.Type1 { using System.Text; using Core; - using Parser.Parts; using Tokens; + using Tokenization; - internal class Type1NameTokenizer : ITokenizer + /// + public class Type1NameTokenizer : ITokenizer { + /// public bool ReadsNextByte { get; } = true; + /// public bool TryTokenize(byte currentByte, IInputBytes inputBytes, out IToken token) { token = null; diff --git a/src/UglyToad.PdfPig.Fonts/UglyToad.PdfPig.Fonts.csproj b/src/UglyToad.PdfPig.Fonts/UglyToad.PdfPig.Fonts.csproj index 0edf8992..8ac5a0cf 100644 --- a/src/UglyToad.PdfPig.Fonts/UglyToad.PdfPig.Fonts.csproj +++ b/src/UglyToad.PdfPig.Fonts/UglyToad.PdfPig.Fonts.csproj @@ -27,6 +27,7 @@ + diff --git a/src/UglyToad.PdfPig.Tests/UglyToad.PdfPig.Tests.csproj b/src/UglyToad.PdfPig.Tests/UglyToad.PdfPig.Tests.csproj index e7a0622b..bcf4a880 100644 --- a/src/UglyToad.PdfPig.Tests/UglyToad.PdfPig.Tests.csproj +++ b/src/UglyToad.PdfPig.Tests/UglyToad.PdfPig.Tests.csproj @@ -100,6 +100,7 @@ + diff --git a/src/UglyToad.PdfPig.Tests/Util/OctalHelpersTests.cs b/src/UglyToad.PdfPig.Tests/Util/OctalHelpersTests.cs index 69ed9649..638157b3 100644 --- a/src/UglyToad.PdfPig.Tests/Util/OctalHelpersTests.cs +++ b/src/UglyToad.PdfPig.Tests/Util/OctalHelpersTests.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.Tests.Util { - using PdfPig.Util; + using PdfPig.Core; using Xunit; public class OctalHelpersTests diff --git a/src/UglyToad.PdfPig/Tokenization/ArrayTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/ArrayTokenizer.cs similarity index 100% rename from src/UglyToad.PdfPig/Tokenization/ArrayTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/ArrayTokenizer.cs diff --git a/src/UglyToad.PdfPig.Tokenization/AssemblyInfo.cs b/src/UglyToad.PdfPig.Tokenization/AssemblyInfo.cs new file mode 100644 index 00000000..c17316b8 --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("UglyToad.PdfPig.Tests")] \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/CommentTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/CommentTokenizer.cs similarity index 96% rename from src/UglyToad.PdfPig/Tokenization/CommentTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/CommentTokenizer.cs index 733d74aa..8f7ed598 100644 --- a/src/UglyToad.PdfPig/Tokenization/CommentTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/CommentTokenizer.cs @@ -2,7 +2,6 @@ { using System.Text; using Core; - using Parser.Parts; using Tokens; internal class CommentTokenizer : ITokenizer diff --git a/src/UglyToad.PdfPig/Tokenization/DictionaryTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/DictionaryTokenizer.cs similarity index 96% rename from src/UglyToad.PdfPig/Tokenization/DictionaryTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/DictionaryTokenizer.cs index 8fddd9c6..d8680975 100644 --- a/src/UglyToad.PdfPig/Tokenization/DictionaryTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/DictionaryTokenizer.cs @@ -1,12 +1,9 @@ namespace UglyToad.PdfPig.Tokenization { using System.Collections.Generic; - using Exceptions; using Core; - using Parser.Parts; using Scanner; using Tokens; - using Util.JetBrains.Annotations; internal class DictionaryTokenizer : ITokenizer { @@ -111,7 +108,6 @@ return result; } - [CanBeNull] private static IToken PeekNext(IReadOnlyList tokens, int currentIndex) { if (tokens.Count - 1 < currentIndex + 1) diff --git a/src/UglyToad.PdfPig/Tokenization/EndOfLineTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/EndOfLineTokenizer.cs similarity index 71% rename from src/UglyToad.PdfPig/Tokenization/EndOfLineTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/EndOfLineTokenizer.cs index 43d759d0..ca4579a5 100644 --- a/src/UglyToad.PdfPig/Tokenization/EndOfLineTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/EndOfLineTokenizer.cs @@ -3,10 +3,15 @@ using Core; using Tokens; - internal class EndOfLineTokenizer : ITokenizer + /// + /// Read an . + /// + public class EndOfLineTokenizer : ITokenizer { + /// public bool ReadsNextByte { get; } = false; + /// public bool TryTokenize(byte currentByte, IInputBytes inputBytes, out IToken token) { token = null; diff --git a/src/UglyToad.PdfPig/Tokenization/HexTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/HexTokenizer.cs similarity index 98% rename from src/UglyToad.PdfPig/Tokenization/HexTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/HexTokenizer.cs index 40de98b9..b461b2fc 100644 --- a/src/UglyToad.PdfPig/Tokenization/HexTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/HexTokenizer.cs @@ -2,7 +2,6 @@ { using System.Collections.Generic; using Core; - using Parser.Parts; using Tokens; internal class HexTokenizer : ITokenizer diff --git a/src/UglyToad.PdfPig.Tokenization/ITokenizer.cs b/src/UglyToad.PdfPig.Tokenization/ITokenizer.cs new file mode 100644 index 00000000..c6066395 --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/ITokenizer.cs @@ -0,0 +1,24 @@ +namespace UglyToad.PdfPig.Tokenization +{ + using Core; + using Tokens; + + /// + /// Reads tokens from input data. + /// + public interface ITokenizer + { + /// + /// Whether this tokenizer type reads the byte following the token itself to detect if the token has ended. + /// + bool ReadsNextByte { get; } + + /// + /// Try and read the token of the corresponding type from the input. + /// + /// The byte read to detect this is the correct tokenizer to use. + /// The input data. + /// The token of the corresponding type if read. + bool TryTokenize(byte currentByte, IInputBytes inputBytes, out IToken token); + } +} \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/NameTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/NameTokenizer.cs similarity index 99% rename from src/UglyToad.PdfPig/Tokenization/NameTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/NameTokenizer.cs index bff34daf..e3345087 100644 --- a/src/UglyToad.PdfPig/Tokenization/NameTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/NameTokenizer.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text; using Core; - using Parser.Parts; using Tokens; internal class NameTokenizer : ITokenizer diff --git a/src/UglyToad.PdfPig/Tokenization/NumericTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/NumericTokenizer.cs similarity index 100% rename from src/UglyToad.PdfPig/Tokenization/NumericTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/NumericTokenizer.cs diff --git a/src/UglyToad.PdfPig/Tokenization/PlainTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/PlainTokenizer.cs similarity index 98% rename from src/UglyToad.PdfPig/Tokenization/PlainTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/PlainTokenizer.cs index c268d9ba..5d1f8486 100644 --- a/src/UglyToad.PdfPig/Tokenization/PlainTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/PlainTokenizer.cs @@ -2,7 +2,6 @@ { using System.Text; using Core; - using Parser.Parts; using Tokens; internal class PlainTokenizer : ITokenizer diff --git a/src/UglyToad.PdfPig/Tokenization/Scanner/CoreTokenScanner.cs b/src/UglyToad.PdfPig.Tokenization/Scanner/CoreTokenScanner.cs similarity index 92% rename from src/UglyToad.PdfPig/Tokenization/Scanner/CoreTokenScanner.cs rename to src/UglyToad.PdfPig.Tokenization/Scanner/CoreTokenScanner.cs index 016efd11..911a4000 100644 --- a/src/UglyToad.PdfPig/Tokenization/Scanner/CoreTokenScanner.cs +++ b/src/UglyToad.PdfPig.Tokenization/Scanner/CoreTokenScanner.cs @@ -3,11 +3,12 @@ using System; using System.Collections.Generic; using Core; - using Exceptions; - using Parser.Parts; using Tokens; - internal class CoreTokenScanner : ISeekableTokenScanner + /// + /// The default for reading PostScript/PDF style data. + /// + public class CoreTokenScanner : ISeekableTokenScanner { private static readonly ArrayTokenizer ArrayTokenizer = new ArrayTokenizer(); private static readonly CommentTokenizer CommentTokenizer = new CommentTokenizer(); @@ -22,10 +23,30 @@ private readonly IInputBytes inputBytes; private readonly List<(byte firstByte, ITokenizer tokenizer)> customTokenizers = new List<(byte, ITokenizer)>(); - internal long CurrentTokenStart { get; private set; } + /// + /// The offset in the input data at which the starts. + /// + public long CurrentTokenStart { get; private set; } + /// public IToken CurrentToken { get; private set; } + /// + public long CurrentPosition => inputBytes.CurrentOffset; + + private bool hasBytePreRead; + private bool isInInlineImage; + + /// + /// Create a new from the input. + /// + public CoreTokenScanner(IInputBytes inputBytes, ScannerScope scope = ScannerScope.None) + { + this.scope = scope; + this.inputBytes = inputBytes ?? throw new ArgumentNullException(nameof(inputBytes)); + } + + /// public bool TryReadToken(out T token) where T : class, IToken { token = default(T); @@ -44,22 +65,13 @@ return false; } + /// public void Seek(long position) { inputBytes.Seek(position); } - public long CurrentPosition => inputBytes.CurrentOffset; - - private bool hasBytePreRead; - private bool isInInlineImage; - - internal CoreTokenScanner(IInputBytes inputBytes, ScannerScope scope = ScannerScope.None) - { - this.scope = scope; - this.inputBytes = inputBytes ?? throw new ArgumentNullException(nameof(inputBytes)); - } - + /// public bool MoveNext() { var endAngleBracesRead = 0; @@ -191,6 +203,7 @@ return false; } + /// public void RegisterCustomTokenizer(byte firstByte, ITokenizer tokenizer) { if (tokenizer == null) @@ -201,6 +214,7 @@ customTokenizers.Add((firstByte, tokenizer)); } + /// public void DeregisterCustomTokenizer(ITokenizer tokenizer) { customTokenizers.RemoveAll(x => ReferenceEquals(x.tokenizer, tokenizer)); diff --git a/src/UglyToad.PdfPig.Tokenization/Scanner/ISeekableTokenScanner.cs b/src/UglyToad.PdfPig.Tokenization/Scanner/ISeekableTokenScanner.cs new file mode 100644 index 00000000..d08c9574 --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/Scanner/ISeekableTokenScanner.cs @@ -0,0 +1,29 @@ +namespace UglyToad.PdfPig.Tokenization.Scanner +{ + /// + /// + /// A that supports seeking in the underlying input data. + /// + public interface ISeekableTokenScanner : ITokenScanner + { + /// + /// Move to the specified position. + /// + void Seek(long position); + + /// + /// The current position in the input. + /// + long CurrentPosition { get; } + + /// + /// Add support for a custom type of tokenizer. + /// + void RegisterCustomTokenizer(byte firstByte, ITokenizer tokenizer); + + /// + /// Remove support for a custom type of tokenizer added with . + /// + void DeregisterCustomTokenizer(ITokenizer tokenizer); + } +} \ No newline at end of file diff --git a/src/UglyToad.PdfPig.Tokenization/Scanner/ITokenScanner.cs b/src/UglyToad.PdfPig.Tokenization/Scanner/ITokenScanner.cs new file mode 100644 index 00000000..50e9971c --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/Scanner/ITokenScanner.cs @@ -0,0 +1,26 @@ +namespace UglyToad.PdfPig.Tokenization.Scanner +{ + using Tokens; + + /// + /// Scan input for PostScript/PDF tokens. + /// + public interface ITokenScanner + { + /// + /// Read the next token in the input. + /// + /// + bool MoveNext(); + + /// + /// The currently read token. + /// + IToken CurrentToken { get; } + + /// + /// Try reading a token of the specific type. + /// + bool TryReadToken(out T token) where T : class, IToken; + } +} \ No newline at end of file diff --git a/src/UglyToad.PdfPig.Tokenization/Scanner/ScannerScope.cs b/src/UglyToad.PdfPig.Tokenization/Scanner/ScannerScope.cs new file mode 100644 index 00000000..1f19b12e --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/Scanner/ScannerScope.cs @@ -0,0 +1,21 @@ +namespace UglyToad.PdfPig.Tokenization.Scanner +{ + /// + /// The current scope of the . + /// + public enum ScannerScope + { + /// + /// Reading normally. + /// + None = 0, + /// + /// Reading inside an array. + /// + Array = 1, + /// + /// Reading inside a dictionary. + /// + Dictionary = 2 + } +} \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/StringTokenizer.cs b/src/UglyToad.PdfPig.Tokenization/StringTokenizer.cs similarity index 99% rename from src/UglyToad.PdfPig/Tokenization/StringTokenizer.cs rename to src/UglyToad.PdfPig.Tokenization/StringTokenizer.cs index bb4af71b..d4c0ad54 100644 --- a/src/UglyToad.PdfPig/Tokenization/StringTokenizer.cs +++ b/src/UglyToad.PdfPig.Tokenization/StringTokenizer.cs @@ -2,9 +2,7 @@ { using System.Text; using Core; - using Parser.Parts; using Tokens; - using Util; internal class StringTokenizer : ITokenizer { diff --git a/src/UglyToad.PdfPig.Tokenization/UglyToad.PdfPig.Tokenization.csproj b/src/UglyToad.PdfPig.Tokenization/UglyToad.PdfPig.Tokenization.csproj new file mode 100644 index 00000000..9afb3bc4 --- /dev/null +++ b/src/UglyToad.PdfPig.Tokenization/UglyToad.PdfPig.Tokenization.csproj @@ -0,0 +1,23 @@ + + + + netstandard2.0;net45;net451;net452;net46;net461;net462;net47 + latest + + + + true + + obj\Debug\netstandard2.0\UglyToad.PdfPig.Core.xml + + + + + + + + + + + + diff --git a/src/UglyToad.PdfPig.sln b/src/UglyToad.PdfPig.sln index b12177e3..909d1579 100644 --- a/src/UglyToad.PdfPig.sln +++ b/src/UglyToad.PdfPig.sln @@ -20,6 +20,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UglyToad.PdfPig.DocumentLay EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UglyToad.PdfPig.Tokens", "UglyToad.PdfPig.Tokens\UglyToad.PdfPig.Tokens.csproj", "{D840FF69-4250-4B05-9829-5ABEC43EC82C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UglyToad.PdfPig.Tokenization", "UglyToad.PdfPig.Tokenization\UglyToad.PdfPig.Tokenization.csproj", "{FD005C50-CD2C-497E-8F7E-6D791091E9B0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -50,6 +52,10 @@ Global {D840FF69-4250-4B05-9829-5ABEC43EC82C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D840FF69-4250-4B05-9829-5ABEC43EC82C}.Release|Any CPU.ActiveCfg = Release|Any CPU {D840FF69-4250-4B05-9829-5ABEC43EC82C}.Release|Any CPU.Build.0 = Release|Any CPU + {FD005C50-CD2C-497E-8F7E-6D791091E9B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD005C50-CD2C-497E-8F7E-6D791091E9B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD005C50-CD2C-497E-8F7E-6D791091E9B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD005C50-CD2C-497E-8F7E-6D791091E9B0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacExpertEncoding.cs b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacExpertEncoding.cs index 17dbffc9..94c7b7bd 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacExpertEncoding.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacExpertEncoding.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.PdfFonts.Encodings { - using Util; + using Core; internal class MacExpertEncoding : Encoding { diff --git a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacOsRomanEncoding.cs b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacOsRomanEncoding.cs index 439f5fd4..c7c12fa4 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacOsRomanEncoding.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacOsRomanEncoding.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.PdfFonts.Encodings { - using Util; + using Core; /// /// Similar to the with 15 additional entries. diff --git a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacRomanEncoding.cs b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacRomanEncoding.cs index a0a3f3bc..2b4838a7 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Encodings/MacRomanEncoding.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Encodings/MacRomanEncoding.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.PdfFonts.Encodings { - using Util; + using Core; internal class MacRomanEncoding : Encoding { diff --git a/src/UglyToad.PdfPig/PdfFonts/Encodings/StandardEncoding.cs b/src/UglyToad.PdfPig/PdfFonts/Encodings/StandardEncoding.cs index e8494a66..f0c69980 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Encodings/StandardEncoding.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Encodings/StandardEncoding.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.PdfFonts.Encodings { - using Util; + using Core; internal class StandardEncoding : Encoding { diff --git a/src/UglyToad.PdfPig/PdfFonts/Encodings/WinAnsiEncoding.cs b/src/UglyToad.PdfPig/PdfFonts/Encodings/WinAnsiEncoding.cs index 7a177505..3aedc487 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Encodings/WinAnsiEncoding.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Encodings/WinAnsiEncoding.cs @@ -1,6 +1,6 @@ namespace UglyToad.PdfPig.PdfFonts.Encodings { - using Util; + using Core; internal class WinAnsiEncoding : Encoding { diff --git a/src/UglyToad.PdfPig/PdfFonts/Type1/Parser/Type1FontParser.cs b/src/UglyToad.PdfPig/PdfFonts/Type1/Parser/Type1FontParser.cs index ee186864..574f6fa0 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Type1/Parser/Type1FontParser.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Type1/Parser/Type1FontParser.cs @@ -5,6 +5,7 @@ using Core; using Encodings; using Fonts; + using Fonts.Type1; using Tokenization; using Tokenization.Scanner; using Tokens; diff --git a/src/UglyToad.PdfPig/Tokenization/ITokenizer.cs b/src/UglyToad.PdfPig/Tokenization/ITokenizer.cs deleted file mode 100644 index b06e7bc4..00000000 --- a/src/UglyToad.PdfPig/Tokenization/ITokenizer.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace UglyToad.PdfPig.Tokenization -{ - using Core; - using Tokens; - - internal interface ITokenizer - { - bool ReadsNextByte { get; } - - bool TryTokenize(byte currentByte, IInputBytes inputBytes, out IToken token); - } -} \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/Scanner/ITokenScanner.cs b/src/UglyToad.PdfPig/Tokenization/Scanner/ITokenScanner.cs deleted file mode 100644 index 6768c47d..00000000 --- a/src/UglyToad.PdfPig/Tokenization/Scanner/ITokenScanner.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace UglyToad.PdfPig.Tokenization.Scanner -{ - using Tokens; - - internal interface ITokenScanner - { - bool MoveNext(); - - IToken CurrentToken { get; } - - bool TryReadToken(out T token) where T : class, IToken; - } - - internal interface ISeekableTokenScanner : ITokenScanner - { - void Seek(long position); - - long CurrentPosition { get; } - - void RegisterCustomTokenizer(byte firstByte, ITokenizer tokenizer); - - void DeregisterCustomTokenizer(ITokenizer tokenizer); - } -} \ No newline at end of file diff --git a/src/UglyToad.PdfPig/Tokenization/Scanner/ScannerScope.cs b/src/UglyToad.PdfPig/Tokenization/Scanner/ScannerScope.cs deleted file mode 100644 index 1025878a..00000000 --- a/src/UglyToad.PdfPig/Tokenization/Scanner/ScannerScope.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace UglyToad.PdfPig.Tokenization.Scanner -{ - internal enum ScannerScope - { - None, - Array, - Dictionary - } -} \ No newline at end of file diff --git a/src/UglyToad.PdfPig/UglyToad.PdfPig.csproj b/src/UglyToad.PdfPig/UglyToad.PdfPig.csproj index 30ec0996..e1b0a1c9 100644 --- a/src/UglyToad.PdfPig/UglyToad.PdfPig.csproj +++ b/src/UglyToad.PdfPig/UglyToad.PdfPig.csproj @@ -52,6 +52,7 @@ +