Comments (3)
It seems that C gives you a surprising amount of flexibility in placing comments.
e.g.
/* comment */ # /* comment */ include /* comment */ <stdio.h> // comment
from guardonce.
It can be even worse...
/*
comment */ # /* comment */ include /* comment */ <stdio.h> /* comment
*/
In the smart parser, I've been stripping comments from the beginning and ends of the lines, because they're usually irrelevant once the code is changed. Unfortunately, it's a little unclear what to do when they span multiple lines. I suspect I should leave them alone. Multi-line comments are probably less likely to be specific to the line I'm removing than single-line comments are.
I've never actually seen this sort of code, but I could imagine it:
/* Copyright <Year> <Author>
<License>
*/ #pragma once
from guardonce.
I should probably mention that the 'smart parser' was dropped in 3af39a7. Not sure if or when I'll work on it again. It would certainly handle a few more weird cases, like the horror above, but I would basically only find out if it was worth the (significant) effort after the fact.
from guardonce.
Related Issues (20)
- Handle Windows line endings on Linux and vice versa HOT 2
- Handle #endif with no space before comments
- Handle include guards with values HOT 1
- Customize once2guard's #endif output HOT 2
- Using include guards and pragma once together HOT 1
- Warn about using reserved symbols for include guards
- Path pattern argument not optional
- once2guard fails on files containing unicode if --endif-style specified HOT 1
- Failures handling unicode in headers when using Python 3 on Windows
- Failures handing UTF-16, UTF-32 encoded files HOT 1
- First line of file is ignored if encoded as UTF-8 with BOM
- once2guard --help throws exception HOT 1
- Allow getting fixed/converted file on stdout HOT 8
- Handling non-ascii encoding with --stdout HOT 7
- Errors when converting files do not result in non-zero exit codes HOT 4
- Add UTF-16 and UTF-32 support
- Add option to read from stdin HOT 3
- Add processing another guard case HOT 2
- cp1251 file processing/autodetect encoding as an option HOT 1
- Extraneous newline is left at the end of file in some cases HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guardonce.