Skip to content

Commit 2328dfc

Browse files
authored
Improved the formatting of source code in the documentation.
1 parent fd620d0 commit 2328dfc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ In implementing syntax macros, Clang's parser is extended by deriving from the c
158158
bool ParseTopLevelDecl(...) override;
159159
...
160160
};
161-
```
161+
```
162162
The methods listed above have been declared as `virtual` in the class `Parser`.
163163
The implementations of these methods in `CaptureParser` handle syntax macros.
164164
From the previous section we know that handling of syntax macros is triggered by one of the tokens `$`, `$$`, `$$$`.
@@ -171,12 +171,11 @@ Syntax macros introduce two new places where ASTs must be built:
171171
2. when a macro is invoked.
172172
173173
Functionality for building ASTs in these places is also added by deriving from the `Sema` class:
174-
175-
```
176-
class CaptureSema : public Sema {
177-
...
178-
};
179-
```
174+
```
175+
class CaptureSema : public Sema {
176+
...
177+
};
178+
```
180179
However, this time no existing methods in `Sema` have to be declared as `virtual`.
181180
This is because `CaptureSema` is only used by `CaptureParser`, and whenever `CaptureParser` calls a method present in both `CaptureSema` and `Sema`, it can be decided statically which class's method implementation is to be called.
182181
Thus no dynamic polymorphism, as facilitated by `virtual` methods, is required in this context.

0 commit comments

Comments
 (0)