An Overview of Document Types
This page allows you to define document types and specify special options for document types. There are three types of document types in ExamDiff Pro:
- Default/Plain Text
is the default document type that is assigned to all files
that do not match any other document types. This document type cannot be deleted or renamed, and
cannot participate in syntax highlighting and comment ignoring.
- System types are
those types that come preinstalled with ExamDiff Pro. They cannot
be deleted or renamed, but can be assigned to different file extensions. These document
types can participate in syntax highlighting and comment ignoring.
- Custom types are those types that are user-created. They are the only types that can be deleted and renamed. These document types can participate in comment ignoring, but cannot participate in syntax highlighting.
Dialog Box OptionsList of document types
Contains a list of all document types, and corresponding file extensions.
Creates a new blank document type.
Deletes the selected document type. Only user-created types can be deleted.
Document type details
Contains options specific to each document type:
- Type name
The name of the document type. Only user-created types can be renamed.
File extensions that the document type applies to.
- Regular expression for comments
The regular expression (if any) that defines comments for the document type. This option can only be set for custom types; system types use the same parsing algorithms that are utilized by syntax highlighting. Note that we use the term "comments" in a very broad sense; any single- or multi-line part of a text file can be considered a "comment" as long as it is defined by a regular expression.
- Single line comments
Single line comments (such as // in C++), use the following regular expression: [comment symbol].*?\n . For example, the regular expression for C++ style comments is //.*?\n . Note the non-greedy ? operator.
- Multi-line comments
Multi-line comments (such as /* */ in C), use the following regular expression: [start comment symbol].*?[end comment symbol] . For example, the regular expression for C-style comments is /\*.*?\*/ . Again, note the non-greedy ? operator.
- Combining comments
Different kinds of comments can be combined ("OR-ed") using the | character. For example, the regular expression /\*.*?\*/|//.*?\n ignores both C and C++ style comments.
- Single line comments
- Tab size
Sets the tab size (that is, the number of spaces in a tab) for the document type. This option only takes effect if Use document type settings is enabled.
- Participate in ignoring comments
Ignore the specified comment during comparison. This option only takes effect if Ignore Comments is enabled.
- Participate in syntax highlighting
Highlights certain syntax elements during comparison. Diff highlighting takes precedence over syntax highlighting, so syntax highlighting only takes effect on identical blocks. This option can only be enabled for system types, and only takes effect if Use document type settings is enabled.
If a file belonging to a document type with syntax highlighting enabled is compared to a file or fragment without syntax highlighting, the syntax highlighting (of the file with syntax highlighting) will be applied to both files. After syntax highlighting is applied, note that it can always be changed for each file individually, using the Set syntax highlighting option in the context menu.
- Syntax colors
This option is only visible if Participate in syntax highlighting is enabled, and enables you to choose colors for each of the five syntax elements that ExamDiff Pro highlights: keywords, preprocessor commands, comments, operators, and numbers. Note that not all of these elements apply to all document types.
If this option is selected and two files are compared, one of which matches a document type and the other only matches the Default type, then both files will be treated as though they match the document type. This is useful for source control, because source control file versions often have extensions different from the actual source files.