#Dyalog APL 16.0 (non-competing), 43 37 bytes
Prompts for comment character, then for code.
↑(↓↑((-(⍸'|'∘=),≢)↑¨'|'∘≠⊆⊢)⍞),¨⊂¯2↑⍞
Non-competing because version 16.0's is newer than this challenge.
#Dyalog APL 16.0 (non-competing), 43 37 bytes
Prompts for comment character, then for code.
↑(↓↑((-(⍸'|'∘=),≢)↑¨'|'∘≠⊆⊢)⍞),¨⊂¯2↑⍞
Non-competing because version 16.0's is newer than this challenge.