[obsidian] vault backup: 2025-07-22 17:09:00[
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (push) Successful in 9m15s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (push) Successful in 9m15s
				
			This commit is contained in:
		
							
								
								
									
										16
									
								
								content/コードフォーマッター.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								content/コードフォーマッター.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					date: 2025-07-22 17:00
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					#programming-language 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					一般的なコードフォーマッターの実装について。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[How to write a code formatter](https://yorickpeterse.com/articles/how-to-write-a-code-formatter/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1行当たり最大文字数がこのくらい、としたときに、どういう戦略で折り返すかは結構難しい問題。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					文字列→トークン→ASTという順番で変換されるので、この逆順が良いのかとも思ったが、
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AST→フォーマッタ用の専用の木構造みたいな中間表現を一度挟んだほうが賢いのかもしれない
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user